From bf443b68c45154703ec5892866cddb15c58fd34e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 07 2020 09:15:49 +0000 Subject: import systemd-239-18.el8_1.5 --- diff --git a/SOURCES/0240-journal-do-not-trigger-assertion-when-journal_file_c.patch b/SOURCES/0240-journal-do-not-trigger-assertion-when-journal_file_c.patch new file mode 100644 index 0000000..75f9aa1 --- /dev/null +++ b/SOURCES/0240-journal-do-not-trigger-assertion-when-journal_file_c.patch @@ -0,0 +1,50 @@ +From 84e849bb006118bc24e8402754c6c5b624bc9efb Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Tue, 28 May 2019 12:40:17 +0900 +Subject: [PATCH] journal: do not trigger assertion when journal_file_close() + get NULL + +We generally expect destructors to not complain if a NULL argument is passed. + +Closes #12400. + +(cherry picked from commit c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d) +(cherry picked from commit dc4c3a5aa35a5e88adcf210471d9460262c8c0d9) +Resolves: #1807350 +--- + src/journal/journal-file.c | 3 ++- + src/journal/journald-server.c | 7 ++----- + 2 files changed, 4 insertions(+), 6 deletions(-) + +diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c +index efc3ee052b..8249b11b23 100644 +--- a/src/journal/journal-file.c ++++ b/src/journal/journal-file.c +@@ -335,7 +335,8 @@ bool journal_file_is_offlining(JournalFile *f) { + } + + JournalFile* journal_file_close(JournalFile *f) { +- assert(f); ++ if (!f) ++ return NULL; + + #if HAVE_GCRYPT + /* Write the final tag */ +diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c +index f2d2856e03..31a7b5ff03 100644 +--- a/src/journal/journald-server.c ++++ b/src/journal/journald-server.c +@@ -1906,11 +1906,8 @@ void server_done(Server *s) { + + client_context_flush_all(s); + +- if (s->system_journal) +- (void) journal_file_close(s->system_journal); +- +- if (s->runtime_journal) +- (void) journal_file_close(s->runtime_journal); ++ (void) journal_file_close(s->system_journal); ++ (void) journal_file_close(s->runtime_journal); + + ordered_hashmap_free_with_destructor(s->user_journals, journal_file_close); + diff --git a/SOURCES/0241-journal-use-cleanup-attribute-at-one-more-place.patch b/SOURCES/0241-journal-use-cleanup-attribute-at-one-more-place.patch new file mode 100644 index 0000000..c5ba94c --- /dev/null +++ b/SOURCES/0241-journal-use-cleanup-attribute-at-one-more-place.patch @@ -0,0 +1,59 @@ +From 8a9a0b62a58e1481b6a0f2e54b323b4eefadc4fd Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Tue, 28 May 2019 18:07:01 +0900 +Subject: [PATCH] journal: use cleanup attribute at one more place + +(cherry picked from commit 627df1dc42b68a74b0882b06366d1185b1a34332) + +Conflicts: + src/journal/journald-server.c + +(cherry picked from commit ceacf935ac9f59bc08b5901f70f227958a2bcf52) +Related: #1807350 +--- + src/journal/journal-file.h | 1 + + src/journal/journald-server.c | 9 ++++----- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h +index cd8a48a364..6a44fd39d2 100644 +--- a/src/journal/journal-file.h ++++ b/src/journal/journal-file.h +@@ -144,6 +144,7 @@ int journal_file_open( + int journal_file_set_offline(JournalFile *f, bool wait); + bool journal_file_is_offlining(JournalFile *f); + JournalFile* journal_file_close(JournalFile *j); ++DEFINE_TRIVIAL_CLEANUP_FUNC(JournalFile*, journal_file_close); + + int journal_file_open_reliably( + const char *fname, +diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c +index 31a7b5ff03..90c146dc67 100644 +--- a/src/journal/journald-server.c ++++ b/src/journal/journald-server.c +@@ -253,8 +253,9 @@ static int open_journal( + bool seal, + JournalMetrics *metrics, + JournalFile **ret) { ++ ++ _cleanup_(journal_file_closep) JournalFile *f = NULL; + int r; +- JournalFile *f; + + assert(s); + assert(fname); +@@ -271,12 +272,10 @@ static int open_journal( + return r; + + r = journal_file_enable_post_change_timer(f, s->event, POST_CHANGE_TIMER_INTERVAL_USEC); +- if (r < 0) { +- (void) journal_file_close(f); ++ if (r < 0) + return r; +- } + +- *ret = f; ++ *ret = TAKE_PTR(f); + return r; + } + diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index 0d29122..9f79b7c 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -13,7 +13,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 18%{?dist}.4 +Release: 18%{?dist}.5 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -289,6 +289,8 @@ Patch0236: 0236-sd-bus-introduce-API-for-re-enqueuing-incoming-messa.patch Patch0237: 0237-sd-event-add-sd_event_source_disable_unref-helper.patch Patch0238: 0238-polkit-when-authorizing-via-PK-let-s-re-resolve-call.patch Patch0239: 0239-sd-bus-use-queue-message-references-for-managing-r-w.patch +Patch0240: 0240-journal-do-not-trigger-assertion-when-journal_file_c.patch +Patch0241: 0241-journal-use-cleanup-attribute-at-one-more-place.patch %ifarch %{ix86} x86_64 aarch64 @@ -908,6 +910,10 @@ fi %files tests -f .file-list-tests %changelog +* Thu Feb 27 2020 systemd maintenance team - 239-18.5 +- journal: do not trigger assertion when journal_file_close() get NULL (#1807350) +- journal: use cleanup attribute at one more place (#1807350) + * Thu Feb 13 2020 systemd maintenance team - 239-18.4 - sd-bus: use "queue" message references for managing r/w message queues in connection objects (CVE-2020-1712)