From: msizanoen Date: Wed, 30 Aug 2023 13:11:42 +0000 (+0700) Subject: journal: Don't write to journal files without the new boot ID update behavior guarantee X-Git-Tag: v255-rc1~606^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f766aca1e1398288e01b26a69eb02a7b831ab00;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 06ffa137d41..1d118583c86 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -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;