systemd: backport patch to fix journal-file issue
PATCH 1/1 systemd: backport patch to fix journal-file issue
From: sureshha <[email protected]>
Backport patch to fix systemd journal-file assertion on removed or corrupted files
Extracted from systemd MR:
https://github.com/systemd/systemd/pull/40378
--- ...not-trigger-assertion-on-removed-or-.patch | 65 +++++++++++++++++++ meta/recipes-core/systemd/systemd_255.21.bb | 1 + 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +65 -0
@@ -0,0 +1,65 @@ +From 1350f39db7e72116c3b2423db02da3ddc8e29082 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <[email protected]> +Date: Sun, 18 Jan 2026 19:15:31 +0900 +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/2185c30de333b09f46ef28b743b123f45e774738] + +Comment: Patch is refreshed as per codebase of v255 + +Signed-off-by: sureshha <[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 08f3b82..633de5b 100644 +--- a/src/libsystemd/sd-journal/journal-file.c ++++ b/src/libsystemd/sd-journal/journal-file.c +@@ -3305,7 +3305,9 @@ use_extra: + + 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; +@@ -3341,7 +3343,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) +@@ -3382,7 +3383,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) +@@ -3423,7 +3423,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.34.1
meta/recipes-core/systemd/systemd_255.21.bb +1 -0
@@ -29,6 +29,7 @@ SRC_URI += " \ file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ file://0003-timedated-Respond-on-org.freedesktop.timedate1.SetNT.patch \ file://0008-implment-systemd-sysv-install-for-OE.patch \ + file://0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch \ " # patches needed by musl
Signature · 1 line
2.34.1
Quoted 9 lines · Suresh H A via lists.openembedded.org
From: sureshha <[email protected]>
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 sureshha <[email protected]>---
Hello,
Thanks for the patch. It looks like this is also needed in whinlatter and master. You need to send this fix there first, before I can take this on scarthgap.
Quoted 17 lines
...not-trigger-assertion-on-removed-or-.patch | 65 +++++++++++++++++++ meta/recipes-core/systemd/systemd_255.21.bb | 1 + 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patchmeta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +6
-0@@ -0,0 +1,65 @@ +From 1350f39db7e72116c3b2423db02da3ddc8e29082 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <[email protected]> +Date: Sun, 18 Jan 2026 19:15:31 +0900 +Subject: [PATCH] journal-file: do not trigger assertion on removed or + corrupted journal file +
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch line 16
Quoted 10 lines
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +10
-0+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/2185c30de333b09f46ef28b743b123f45e774738]
That URL point to an unmerged commit.
I think you want this one: https://github.com/systemd/systemd/commit/112cbc37906fb97afe0ad04164262cf62d0af5e9
Thanks!
Quoted 61 lines
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +49
-0+ +Comment: Patch is refreshed as per codebase of v255 + +Signed-off-by: sureshha <[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 08f3b82..633de5b 100644 +--- a/src/libsystemd/sd-journal/journal-file.c ++++ b/src/libsystemd/sd-journal/journal-file.c +@@ -3305,7 +3305,9 @@ use_extra: + + 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; +@@ -3341,7 +3343,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) +@@ -3382,7 +3383,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) +@@ -3423,7 +3423,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.34.1meta/recipes-core/systemd/systemd_255.21.bb +1
-0@@ -29,6 +29,7 @@ SRC_URI += " \ file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ file://0003-timedated-Respond-on-org.freedesktop.timedate1.SetNT.patch \ file://0008-implment-systemd-sysv-install-for-OE.patch \ + file://0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch \ " # patches needed by musl
Signature · 2 lines
Yoann Congal Smile ECS
Sure, will provide the patches for whinlatter and master.
Thanks,
Suresh H A
________________________________
From: Yoann Congal <[email protected]>
Sent: 28 March 2026 05:06
To: GitHub Send patches <[email protected]>; [email protected] <[email protected]>
Cc: sureshha <[email protected]>; Suresh H A <[email protected]>
Subject: Re: [OE-core][scarthgap][PATCH] systemd: backport patch to fix journal-file issue
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Caution: "External email, be cautious especially with link(s), attachment(s) or QR code(s)".
Quoted 9 lines · Suresh H A via lists.openembedded.org
From: sureshha <[email protected]>
Backport patch to fix systemd journal-file assertion on removed or corrupted files
Extracted from systemd MR:
https://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsystemd%2Fsystemd%2Fpull%2F40378&data=05%7C02%7Csuresh.ha%40bmwtechworks.in%7Cde821bb1bc804569944f08de8c59abcd%7C970fa6fd10314cc68c56488f3c61cd05%7C0%7C0%7C639102513948436427%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eCA1bKiWVhr71752KM1cSzcFWuvML4MUpyBr6dcduDI%3D&reserved=0<https://github.com/systemd/systemd/pull/40378>Signed-off-by sureshha <[email protected]>---
Hello,
Thanks for the patch. It looks like this is also needed in whinlatter and master. You need to send this fix there first, before I can take this on scarthgap.
Quoted 17 lines
...not-trigger-assertion-on-removed-or-.patch | 65 +++++++++++++++++++ meta/recipes-core/systemd/systemd_255.21.bb | 1 + 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patchmeta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +6
-0@@ -0,0 +1,65 @@ +From 1350f39db7e72116c3b2423db02da3ddc8e29082 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <[email protected]> +Date: Sun, 18 Jan 2026 19:15:31 +0900 +Subject: [PATCH] journal-file: do not trigger assertion on removed or + corrupted journal file +
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch line 16
Quoted 10 lines
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +10
-0+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://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsystemd%2Fsystemd%2Fpull%2F40372%23issuecomment-3762907261&data=05%7C02%7Csuresh.ha%40bmwtechworks.in%7Cde821bb1bc804569944f08de8c59abcd%7C970fa6fd10314cc68c56488f3c61cd05%7C0%7C0%7C639102513948454648%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=m1w07Fr3ZqgcLxyCWOhvGvP9ppf%2Fb8y0zv1c7AfCba8%3D&reserved=0. + +Upstream-Status: Backport [https://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsystemd%2Fsystemd%2Fcommit%2F2185c30de333b09f46ef28b743b123f45e774738&data=05%7C02%7Csuresh.ha%40bmwtechworks.in%7Cde821bb1bc804569944f08de8c59abcd%7C970fa6fd10314cc68c56488f3c61cd05%7C0%7C0%7C639102513948467501%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=NysT%2FxRixv3o3%2Fmyw0JcWOVPwItEav2ZI9dDWDDC8ug%3D&reserved=0<https://github.com/systemd/systemd/commit/2185c30de333b09f46ef28b743b123f45e774738>]
That URL point to an unmerged commit.
I think you want this one: https://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsystemd%2Fsystemd%2Fcommit%2F112cbc37906fb97afe0ad04164262cf62d0af5e9&data=05%7C02%7Csuresh.ha%40bmwtechworks.in%7Cde821bb1bc804569944f08de8c59abcd%7C970fa6fd10314cc68c56488f3c61cd05%7C0%7C0%7C639102513948479759%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=3e11ATD0T%2FGIB4Qmii4ElwYX96iGYHJbZgcG2loWzcQ%3D&reserved=0<https://github.com/systemd/systemd/commit/112cbc37906fb97afe0ad04164262cf62d0af5e9>
Thanks!
Quoted 54 lines
meta/recipes-core/systemd/systemd/0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch new file +49
-0+ +Comment: Patch is refreshed as per codebase of v255 + +Signed-off-by: sureshha <[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 08f3b82..633de5b 100644 +--- a/src/libsystemd/sd-journal/journal-file.c ++++ b/src/libsystemd/sd-journal/journal-file.c +@@ -3305,7 +3305,9 @@ use_extra: + + 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; +@@ -3341,7 +3343,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) +@@ -3382,7 +3383,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) +@@ -3423,7 +3423,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.34.1meta/recipes-core/systemd/systemd_255.21.bb +0
-0
meta/recipes-core/systemd/systemd_255.21.bb SRC_URI += " \ · line 35
Quoted 7 lines
meta/recipes-core/systemd/systemd_255.21.bb +1
-0@@ -29,6 +29,7 @@ SRC_URI += " \ file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ file://0003-timedated-Respond-on-org.freedesktop.timedate1.SetNT.patch \ file://0008-implment-systemd-sysv-install-for-OE.patch \ + file://0023-journal-file-do-not-trigger-assertion-on-removed-or-.patch \ " # patches needed by musl
--
Yoann Congal
Smile ECS