69 lines
3.2 KiB
Diff
69 lines
3.2 KiB
Diff
From bf022f9f4841368bb84372ee5605ce5c0f936c79 Mon Sep 17 00:00:00 2001
|
|
From: Daan De Meyer <daan.j.demeyer@gmail.com>
|
|
Date: Wed, 12 Jan 2022 14:44:50 +0000
|
|
Subject: [PATCH] journal: Skip data objects with invalid offsets
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
We already skip invalid objects, but don't yet skip invalid offsets.
|
|
Let's skip these as well to improve robustness when we're dealing with
|
|
corrupted journals.
|
|
|
|
Before:
|
|
|
|
```
|
|
➜ systemd git:(main) build/journalctl -r -n 5 --file ~/Downloads/system@0005d2b275abaaf8-f243a2818cb39b98.journal_
|
|
Failed to get journal fields: Cannot assign requested address
|
|
-- No entries --
|
|
```
|
|
|
|
After:
|
|
|
|
```
|
|
➜ systemd git:(main) ✗ build/journalctl -r -n 5 --file ~/Downloads/system@0005d2b275abaaf8-f243a2818cb39b98.journal_
|
|
Dec 09 08:32:38 snowball3 NetworkManager[911]: <info> [1639038758.1464] device (wlp1s0): supplicant interface state: scanning -> authenticating
|
|
Dec 09 08:32:38 snowball3 kernel: wlp1s0: send auth to ec:a9:40:79:fb:ad (try 1/3)
|
|
Dec 09 08:32:38 snowball3 kernel: wlp1s0: authenticate with ec:a9:40:79:fb:ad
|
|
Dec 09 08:32:38 snowball3 wpa_supplicant[1003]: wlp1s0: SME: Trying to authenticate with ec:a9:40:79:fb:ad (SSID='UPC949397B' freq=5500 MHz)
|
|
```
|
|
|
|
(cherry picked from commit df207ccb7be02b1ca6bdd0a2066a898e5b24ee86)
|
|
(cherry picked from commit 556f46aa3b17f4ed6768521137405297c8a99d35)
|
|
|
|
Conflict:NA
|
|
Reference:https://github.com/systemd/systemd/commit/bf022f9f4841368bb84372ee5605ce5c0f936c79
|
|
---
|
|
src/libsystemd/sd-journal/sd-journal.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
|
|
index dd28b8008f..3cdc629a8d 100644
|
|
--- a/src/libsystemd/sd-journal/sd-journal.c
|
|
+++ b/src/libsystemd/sd-journal/sd-journal.c
|
|
@@ -2310,8 +2310,8 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
|
|
p = le64toh(o->entry.items[i].object_offset);
|
|
le_hash = o->entry.items[i].hash;
|
|
r = journal_file_move_to_object(f, OBJECT_DATA, p, &d);
|
|
- if (r == -EBADMSG) {
|
|
- log_debug("Entry item %"PRIu64" data object is bad, skipping over it.", i);
|
|
+ if (IN_SET(r, -EADDRNOTAVAIL, -EBADMSG)) {
|
|
+ log_debug_errno(r, "Entry item %"PRIu64" data object is bad, skipping over it: %m", i);
|
|
continue;
|
|
}
|
|
if (r < 0)
|
|
@@ -2455,8 +2455,8 @@ _public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t
|
|
p = le64toh(o->entry.items[j->current_field].object_offset);
|
|
le_hash = o->entry.items[j->current_field].hash;
|
|
r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
|
|
- if (r == -EBADMSG) {
|
|
- log_debug("Entry item %"PRIu64" data object is bad, skipping over it.", j->current_field);
|
|
+ if (IN_SET(r, -EADDRNOTAVAIL, -EBADMSG)) {
|
|
+ log_debug_errno(r, "Entry item %"PRIu64" data object is bad, skipping over it: %m", j->current_field);
|
|
continue;
|
|
}
|
|
if (r < 0)
|
|
--
|
|
2.33.0
|
|
|