]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: Don't write to journal files without the new boot ID update behavior guarantee
authormsizanoen <msizanoen@qtmlabs.xyz>
Wed, 30 Aug 2023 13:11:42 +0000 (20:11 +0700)
committermsizanoen <msizanoen@qtmlabs.xyz>
Wed, 30 Aug 2023 13:16:45 +0000 (20:16 +0700)
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.

src/libsystemd/sd-journal/journal-file.c

index 06ffa137d41f1c59c390971aeb53313f72af8e99..1d118583c8631db9cce659992a469570fe0cd51d 100644 (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;