SHA256
1
0
forked from pool/systemd
systemd/0006-journal-assume-that-next-entry-is-after-previous-ent.patch
Stephan Kulow bbba62be60 Accepting request 225408 from Base:System
- Add or port upstream bugfix patches: 
  0001-Fix-systemd-stdio-bridge-symlink.patch
  0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch
  0003-Do-not-print-invalid-UTF-8-in-error-messages.patch
  0004-man-document-missing-options-of-systemd-run.patch
  0005-systemd-run-add-some-extra-safety-checks.patch
  0006-journal-assume-that-next-entry-is-after-previous-ent.patch
  0007-journal-forget-file-after-encountering-an-error.patch
  0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch
  0009-logind-fix-reference-to-systemd-user-sessions.servic.patch
  0010-man-update-link-to-LSB.patch
  0011-man-systemd-bootchart-fix-spacing-in-command.patch
  0012-man-add-missing-comma.patch
  0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch

- Add linker scripts as place holder of the old systemd shared
  libraries now all included in libsystemd.so  (bnc#867128)

- Make patch 1006-udev-always-rename-network.patch work again
  and add it again. 

- address missing owner functionality in systemd-tmpfiles (fate#314974)
  1022-systemd-tmpfiles-ownerkeep.patch

- Generate the bash completion files on the fly for the case of
  not having the package bash-completion around 
- Add or port upstream bugfix patches:
  0001-nspawn-fix-detection-of-missing-proc-self-loginuid.patch
  0002-cdrom_id-use-the-old-MMC-fallback.patch
  0003-journalctl-refuse-extra-arguments-with-verify-and-si.patch

OBS-URL: https://build.opensuse.org/request/show/225408
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=177
2014-03-11 08:24:11 +00:00

71 lines
2.5 KiB
Diff

From fb099c8d2af6620db2709e826a258089d10cdfe8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 27 Feb 2014 00:07:29 -0500
Subject: [PATCH] journal: assume that next entry is after previous entry
With a corrupted file, we can get in a situation where two entries
in the entry array point to the same object. Then journal_file_next_entry
will find the first one using generic_arrray_bisect, and try to move to
the second one, but since the address is the same, generic_array_get will
return the first one. journal_file_next_entry ends up in an infinite loop.
https://bugzilla.redhat.com/show_bug.cgi?id=1047039
---
src/journal/journal-file.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 5876733..0e1fc7f 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -1359,7 +1359,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
}
typedef struct ChainCacheItem {
- uint64_t first; /* the array at the begin of the chain */
+ uint64_t first; /* the array at the beginning of the chain */
uint64_t array; /* the cached array */
uint64_t begin; /* the first item in the cached array */
uint64_t total; /* the total number of items in all arrays before this one in the chain */
@@ -1945,7 +1945,7 @@ int journal_file_next_entry(
direction_t direction,
Object **ret, uint64_t *offset) {
- uint64_t i, n;
+ uint64_t i, n, ofs;
int r;
assert(f);
@@ -1986,10 +1986,24 @@ int journal_file_next_entry(
}
/* And jump to it */
- return generic_array_get(f,
- le64toh(f->header->entry_array_offset),
- i,
- ret, offset);
+ r = generic_array_get(f,
+ le64toh(f->header->entry_array_offset),
+ i,
+ ret, &ofs);
+ if (r <= 0)
+ return r;
+
+ if (p > 0 &&
+ (direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) {
+ log_debug("%s: entry array corrupted at entry %"PRIu64,
+ f->path, i);
+ return -EBADMSG;
+ }
+
+ if (offset)
+ *offset = ofs;
+
+ return 1;
}
int journal_file_skip_entry(
--
1.7.9.2