systemd: backport patch to fix journal-file issue
PATCH v4 1/1 systemd: backport patch to fix journal-file issue
Backport patch to fix systemd journal-file assertion on removed or corrupted files.
Extracted from systemd MR:
https://github.com/systemd/systemd/pull/40378
Signed-off-by Suresh H A <[email protected]>
--- ...not-trigger-assertion-on-removed-or-.patch | 67 +++++++++++++++++++ meta/recipes-core/systemd/systemd_250.14.bb | 1 + 2 files changed, 68 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0029-journal-file-do-not-trigger-assertion-on-removed-or-.patch
meta/recipes-core/systemd/systemd/0029-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +67 -0
@@ -0,0 +1,67 @@ +From e89f166158b72a6ad022c9c795983bfe0a20cc36 Mon Sep 17 00:00:00 2001 +From: Suresh H A <[email protected]> +Date: Mon, 25 May 2026 22:58:17 +0530 +Subject: [PATCH] journal-file: do not trigger assertion on removed or + corrupted journal file + +When a journal file is removed or corrupted, then the value `p`, which is +read from Object.data.entry_offset, may be zero. + +Note, journal_file_move_to_object() checks the passed offset and return +-EBADMSG if it is invalid. + +Fixes the issue reported at +https://github.com/systemd/systemd/pull/40372#issuecomment-3762907261. + +Upstream-Status: Backport +[https://github.com/systemd/systemd/commit/112cbc37906fb97afe0ad04164262cf62d0af5e9] + +Comment: Patch is refreshed as per the codebase of v250 + +Signed-off-by: Suresh H A <[email protected]> +--- + src/libsystemd/sd-journal/journal-file.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c +index bac258ca42..7b6b7eea2e 100644 +--- a/src/libsystemd/sd-journal/journal-file.c ++++ b/src/libsystemd/sd-journal/journal-file.c +@@ -2602,7 +2602,9 @@ found: + + _pure_ static int test_object_offset(JournalFile *f, uint64_t p, uint64_t needle) { + assert(f); +- assert(p > 0); ++ ++ if (p <= 0) ++ return -EBADMSG; + + if (p == needle) + return TEST_FOUND; +@@ -2618,7 +2620,6 @@ static int test_object_seqnum(JournalFile *f, uint64_t p, uint64_t needle) { + int r; + + assert(f); +- assert(p > 0); + + r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); + if (r < 0) +@@ -2658,7 +2659,6 @@ static int test_object_realtime(JournalFile *f, uint64_t p, uint64_t needle) { + int r; + + assert(f); +- assert(p > 0); + + r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); + if (r < 0) +@@ -2698,7 +2698,6 @@ static int test_object_monotonic(JournalFile *f, uint64_t p, uint64_t needle) { + int r; + + assert(f); +- assert(p > 0); + + r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); + if (r < 0) +-- +2.43.0 +
meta/recipes-core/systemd/systemd_250.14.bb +1 -0
@@ -35,6 +35,7 @@ SRC_URI += "file://touchscreen.rules \ file://CVE-2025-4598-0002.patch \ file://CVE-2025-4598-0003.patch \ file://CVE-2025-4598-0004.patch \ + file://0029-journal-file-do-not-trigger-assertion-on-removed-or-.patch \ " # patches needed by musl
Signature · 1 line
2.43.0
Quoted 6 lines · Suresh H A via lists.openembedded.org
Backport patch to fix systemd journal-file assertion on removed or corrupted files.
Extracted from systemd MR:
https://github.com/systemd/systemd/pull/40378Signed-off-by Suresh H A <[email protected]>
Hello,
Kirkstone is EOL so I can't accept this patch, sorry.
You might try to send it to meta-lts-collab[0] but, since this is a bugfix and not a security fix, this patch might be out-of-scope.
[0]: https://git.yoctoproject.org/meta-lts-collab/about/?h=kirkstone
Regards,
Quoted 91 lines
--- ...not-trigger-assertion-on-removed-or-.patch | 67 +++++++++++++++++++ meta/recipes-core/systemd/systemd_250.14.bb | 1 + 2 files changed, 68 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0029-journal-file-do-not-trigger-assertion-on-removed-or-.patchmeta/recipes-core/systemd/systemd/0029-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +67
-0@@ -0,0 +1,67 @@ +From e89f166158b72a6ad022c9c795983bfe0a20cc36 Mon Sep 17 00:00:00 2001 +From: Suresh H A <[email protected]> +Date: Mon, 25 May 2026 22:58:17 +0530 +Subject: [PATCH] journal-file: do not trigger assertion on removed or + corrupted journal file + +When a journal file is removed or corrupted, then the value `p`, which is +read from Object.data.entry_offset, may be zero. + +Note, journal_file_move_to_object() checks the passed offset and return +-EBADMSG if it is invalid. + +Fixes the issue reported at +https://github.com/systemd/systemd/pull/40372#issuecomment-3762907261. + +Upstream-Status: Backport +[https://github.com/systemd/systemd/commit/112cbc37906fb97afe0ad04164262cf62d0af5e9] + +Comment: Patch is refreshed as per the codebase of v250 + +Signed-off-by: Suresh H A <[email protected]> +--- + src/libsystemd/sd-journal/journal-file.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c +index bac258ca42..7b6b7eea2e 100644 +--- a/src/libsystemd/sd-journal/journal-file.c ++++ b/src/libsystemd/sd-journal/journal-file.c +@@ -2602,7 +2602,9 @@ found: + + _pure_ static int test_object_offset(JournalFile *f, uint64_t p, uint64_t needle) { + assert(f); +- assert(p > 0); ++ ++ if (p <= 0) ++ return -EBADMSG; + + if (p == needle) + return TEST_FOUND; +@@ -2618,7 +2620,6 @@ static int test_object_seqnum(JournalFile *f, uint64_t p, uint64_t needle) { + int r; + + assert(f); +- assert(p > 0); + + r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); + if (r < 0) +@@ -2658,7 +2659,6 @@ static int test_object_realtime(JournalFile *f, uint64_t p, uint64_t needle) { + int r; + + assert(f); +- assert(p > 0); + + r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); + if (r < 0) +@@ -2698,7 +2698,6 @@ static int test_object_monotonic(JournalFile *f, uint64_t p, uint64_t needle) { + int r; + + assert(f); +- assert(p > 0); + + r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); + if (r < 0) +-- +2.43.0 +meta/recipes-core/systemd/systemd_250.14.bb +1
-0@@ -35,6 +35,7 @@ SRC_URI += "file://touchscreen.rules \ file://CVE-2025-4598-0002.patch \ file://CVE-2025-4598-0003.patch \ file://CVE-2025-4598-0004.patch \ + file://0029-journal-file-do-not-trigger-assertion-on-removed-or-.patch \ " # patches needed by musl
Signature · 2 lines
Yoann Congal Smile ECS