1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-07 05:57:46 +03:00

journal: Don't write to journal files without the new boot ID update behavior guarantee

With the old boot ID update behavior there's no way to compare the boot
ID of a new entry to be written with the boot ID of the last entry in
the journal in a performant manner, and therefore no way to determine if
monotonic clock value consistency checking is needed. Refuse to open
journal files without the new boot ID update behavior guarantee to
simplify consistency checking.
This commit is contained in:
msizanoen 2023-08-30 20:11:42 +07:00
parent 73ac9520ec
commit 2f766aca1e

View File

@ -572,6 +572,10 @@ static int journal_file_verify_header(JournalFile *f) {
if (journal_file_writable(f) && header_size != sizeof(Header))
return -EPROTONOSUPPORT;
/* Don't write to journal files without the new boot ID update behavior guarantee. */
if (journal_file_writable(f) && !JOURNAL_HEADER_TAIL_ENTRY_BOOT_ID(f->header))
return -EPROTONOSUPPORT;
if (JOURNAL_HEADER_SEALED(f->header) && !JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays))
return -EBADMSG;