From 103b4cae5f40f9e67a2d3fc55b9de1be65d6a10e Mon Sep 17 00:00:00 2001 From: Tomas Heinrich Date: Mon, 17 Jun 2013 15:21:13 +0200 Subject: [PATCH] Rebase to 7.4.1 - regenerate patch 0 - drop patches merged upstream: 4..8 - add a dependency on the version of systemd which resolves rhbz#974132 - update option name in rsyslog.conf --- .gitignore | 1 + rsyslog-7.4.0-imjournal-segv.rhbz971471.patch | 35 -------- rsyslog-7.4.0-no-ste-file-segv.patch | 87 ------------------- ...og-7.4.0-ratelimiter-loop.rhbz971471.patch | 38 -------- ...g-7.4.0-ratelimiter-loop2.rhbz971471.patch | 29 ------- rsyslog-7.4.0-ratelimiter-reset.patch | 27 ------ rsyslog-7.4.1-sd-service.patch | 13 +++ rsyslog.conf | 2 +- rsyslog.spec | 32 +++---- sources | 2 +- 10 files changed, 32 insertions(+), 234 deletions(-) delete mode 100644 rsyslog-7.4.0-imjournal-segv.rhbz971471.patch delete mode 100644 rsyslog-7.4.0-no-ste-file-segv.patch delete mode 100644 rsyslog-7.4.0-ratelimiter-loop.rhbz971471.patch delete mode 100644 rsyslog-7.4.0-ratelimiter-loop2.rhbz971471.patch delete mode 100644 rsyslog-7.4.0-ratelimiter-reset.patch create mode 100644 rsyslog-7.4.1-sd-service.patch diff --git a/.gitignore b/.gitignore index 2373ae2..cb268e3 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ rsyslog-4.6.3.tar.gz /rsyslog-7.3.10.tar.gz /rsyslog-7.3.15-20130604git6e72fa6.tar.gz /rsyslog-7.4.0.tar.gz +/rsyslog-7.4.1.tar.gz diff --git a/rsyslog-7.4.0-imjournal-segv.rhbz971471.patch b/rsyslog-7.4.0-imjournal-segv.rhbz971471.patch deleted file mode 100644 index 45149b2..0000000 --- a/rsyslog-7.4.0-imjournal-segv.rhbz971471.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0082647fa5e6849b83ab4c6b9ab2e8803245db14 Mon Sep 17 00:00:00 2001 -From: Tomas Heinrich -Date: Fri, 7 Jun 2013 01:15:10 +0200 -Subject: [PATCH] bugfix: be more tolerant to malformed journal fields - -This prevents a segfault when a malformed journal entry field doesn't -contain an equal sign. Should not ever happen but was actually -triggered by a real bug in systemd journal. ---- - plugins/imjournal/imjournal.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c -index ae29154..cce45b9 100755 ---- a/plugins/imjournal/imjournal.c -+++ b/plugins/imjournal/imjournal.c -@@ -244,7 +244,14 @@ readjournal() { - SD_JOURNAL_FOREACH_DATA(j, get, l) { - /* locate equal sign, this is always present */ - equal_sign = memchr(get, '=', l); -- assert (equal_sign != NULL); -+ -+ /* ... but we know better than to trust the specs */ -+ if (equal_sign == NULL) { -+ errmsg.LogError(0, RS_RET_ERR,"SD_JOURNAL_FOREACH_DATA()" -+ " returned a malformed field (has no '='): '%s'", -+ get); -+ continue; /* skip the entry */ -+ } - - /* get length of journal data prefix */ - prefixlen = ((char *)equal_sign - (char *)get); --- -1.7.10.4 - diff --git a/rsyslog-7.4.0-no-ste-file-segv.patch b/rsyslog-7.4.0-no-ste-file-segv.patch deleted file mode 100644 index 36668ed..0000000 --- a/rsyslog-7.4.0-no-ste-file-segv.patch +++ /dev/null @@ -1,87 +0,0 @@ -From ad9108eaf9164225f9149ed2b3b5c3184e1cb487 Mon Sep 17 00:00:00 2001 -From: Tomas Heinrich -Date: Wed, 12 Jun 2013 13:38:34 +0200 -Subject: [PATCH] bugfix: prevent a segfault if state file is not defined - ---- - plugins/imjournal/imjournal.c | 43 +++++++++++++++++++++++++++++------------ - 1 file changed, 31 insertions(+), 12 deletions(-) - -diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c -index cce45b9..26b385c 100755 ---- a/plugins/imjournal/imjournal.c -+++ b/plugins/imjournal/imjournal.c -@@ -434,12 +434,13 @@ finalize_it: - } - - --BEGINrunInput --CODESTARTrunInput -- /* this is an endless loop - it is terminated when the thread is -- * signalled to do so. This, however, is handled by the framework, -- * right into the sleep below. -- */ -+/* This function loads a journal cursor from the state file. -+ */ -+static rsRetVal -+loadJournalState() -+{ -+ DEFiRet; -+ - if (cs.stateFile[0] != '/') { - char *new_stateFile; - -@@ -479,6 +480,20 @@ CODESTARTrunInput - } - } - -+finalize_it: -+ RETiRet; -+} -+ -+BEGINrunInput -+CODESTARTrunInput -+ /* this is an endless loop - it is terminated when the thread is -+ * signalled to do so. This, however, is handled by the framework. -+ */ -+ -+ if (cs.stateFile) { -+ CHKiRet(loadJournalState()); -+ } -+ - while (glbl.GetGlobalInputTermState() == 0) { - int count = 0, r; - -@@ -499,11 +514,13 @@ CODESTARTrunInput - } - - CHKiRet(readjournal()); -- /* TODO: This could use some finer metric. */ -- count++; -- if (count == cs.iPersistStateInterval) { -- count = 0; -- persistJournalState(); -+ if (cs.stateFile) { /* can't persist without a state file */ -+ /* TODO: This could use some finer metric. */ -+ count++; -+ if (count == cs.iPersistStateInterval) { -+ count = 0; -+ persistJournalState(); -+ } - } - } - -@@ -552,7 +569,9 @@ ENDwillRun - /* close journal */ - BEGINafterRun - CODESTARTafterRun -- persistJournalState(); -+ if (cs.stateFile) { /* can't persist without a state file */ -+ persistJournalState(); -+ } - sd_journal_close(j); - ENDafterRun - --- -1.7.10.4 - diff --git a/rsyslog-7.4.0-ratelimiter-loop.rhbz971471.patch b/rsyslog-7.4.0-ratelimiter-loop.rhbz971471.patch deleted file mode 100644 index 9d201b3..0000000 --- a/rsyslog-7.4.0-ratelimiter-loop.rhbz971471.patch +++ /dev/null @@ -1,38 +0,0 @@ -From f11a873dc4e258c346765af9d5d23a1180493ee8 Mon Sep 17 00:00:00 2001 -From: Tomas Heinrich -Date: Sat, 8 Jun 2013 23:27:48 +0200 -Subject: [PATCH 2/2] bugfix: prevent an endless loop in the ratelimiter - -If messages are being dropped because of ratelimiting, an internal -message is generated to inform about this fact. This should happen -only uppon the firs occurance but the counter that tracks the number -of dropped messages was incremented only after sending the message. If -the message itself gets ratelimited, an endless loop spins out of -control. Thanks to Jerry James for notifying about this. ---- - runtime/ratelimit.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c -index d83da2d..ec24855 100644 ---- a/runtime/ratelimit.c -+++ b/runtime/ratelimit.c -@@ -167,13 +167,13 @@ withinRatelimit(ratelimit_t *ratelimit, time_t tt) - ratelimit->done++; - ret = 1; - } else { -- if(ratelimit->missed == 0) { -+ ratelimit->missed++; -+ if(ratelimit->missed == 1) { - snprintf((char*)msgbuf, sizeof(msgbuf), - "%s: begin to drop messages due to rate-limiting", - ratelimit->name); - logmsgInternal(RS_RET_RATE_LIMITED, LOG_SYSLOG|LOG_INFO, msgbuf, 0); - } -- ratelimit->missed++; - ret = 0; - } - --- -1.7.10.4 - diff --git a/rsyslog-7.4.0-ratelimiter-loop2.rhbz971471.patch b/rsyslog-7.4.0-ratelimiter-loop2.rhbz971471.patch deleted file mode 100644 index 15c1038..0000000 --- a/rsyslog-7.4.0-ratelimiter-loop2.rhbz971471.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 82db8e6fbba89bf486cc7e642e4f8daaa43852e8 Mon Sep 17 00:00:00 2001 -From: Tomas Heinrich -Date: Mon, 10 Jun 2013 23:09:38 +0200 -Subject: [PATCH] bugfix: prevent another endless loop in the ratelimiter - -The message that reports how many messages were lost due to -ratelimiting was sent before reseting the state that led to it. If it -itself got ratelimited, this could lead to an endless loop. ---- - runtime/ratelimit.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c -index ec24855..443a5fa 100644 ---- a/runtime/ratelimit.c -+++ b/runtime/ratelimit.c -@@ -128,8 +128,8 @@ tellLostCnt(ratelimit_t *ratelimit) - snprintf((char*)msgbuf, sizeof(msgbuf), - "%s: %u messages lost due to rate-limiting", - ratelimit->name, ratelimit->missed); -- logmsgInternal(RS_RET_RATE_LIMITED, LOG_SYSLOG|LOG_INFO, msgbuf, 0); - ratelimit->missed = 0; -+ logmsgInternal(RS_RET_RATE_LIMITED, LOG_SYSLOG|LOG_INFO, msgbuf, 0); - } - } - --- -1.7.10.4 - diff --git a/rsyslog-7.4.0-ratelimiter-reset.patch b/rsyslog-7.4.0-ratelimiter-reset.patch deleted file mode 100644 index bc7bacb..0000000 --- a/rsyslog-7.4.0-ratelimiter-reset.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 489541d2a901c5fedd9cbbdc8ad0df557fdabddd Mon Sep 17 00:00:00 2001 -From: Tomas Heinrich -Date: Tue, 11 Jun 2013 16:27:37 +0200 -Subject: [PATCH] bugfix: prevent calling tellLostCnt() twice - ---- - runtime/ratelimit.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c -index ec24855..8f5bcef 100644 ---- a/runtime/ratelimit.c -+++ b/runtime/ratelimit.c -@@ -157,9 +157,9 @@ withinRatelimit(ratelimit_t *ratelimit, time_t tt) - - /* resume if we go out of out time window */ - if(tt > ratelimit->begin + ratelimit->interval) { -- tellLostCnt(ratelimit); - ratelimit->begin = 0; - ratelimit->done = 0; -+ tellLostCnt(ratelimit); - } - - /* do actual limit check */ --- -1.7.10.4 - diff --git a/rsyslog-7.4.1-sd-service.patch b/rsyslog-7.4.1-sd-service.patch new file mode 100644 index 0000000..69114ed --- /dev/null +++ b/rsyslog-7.4.1-sd-service.patch @@ -0,0 +1,13 @@ +diff -up rsyslog-7.4.1/rsyslog.service.in.orig rsyslog-7.4.1/rsyslog.service.in +--- rsyslog-7.4.1/rsyslog.service.in.orig 2013-06-17 15:28:54.430023493 +0200 ++++ rsyslog-7.4.1/rsyslog.service.in 2013-06-17 15:30:05.874378084 +0200 +@@ -4,7 +4,8 @@ Requires=syslog.socket + + [Service] + Type=notify +-ExecStart=@sbindir@/rsyslogd -n ++EnvironmentFile=-/etc/sysconfig/rsyslog ++ExecStart=@sbindir@/rsyslogd -n $SYSLOGD_OPTIONS + StandardOutput=null + + [Install] diff --git a/rsyslog.conf b/rsyslog.conf index 2e2dd90..6972b4d 100644 --- a/rsyslog.conf +++ b/rsyslog.conf @@ -40,7 +40,7 @@ $IncludeConfig /etc/rsyslog.d/*.conf $OmitLocalLogging on # File to store the position in the journal -$StateFile imjournal.state +$IMJournalStateFile imjournal.state #### RULES #### diff --git a/rsyslog.spec b/rsyslog.spec index 5432520..82b51e1 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -12,7 +12,7 @@ Summary: Enhanced system logging and kernel message trapping daemon Name: rsyslog -Version: 7.4.0 +Version: 7.4.1 Release: 1%{?dist} License: (GPLv3+ and ASL 2.0) Group: System Environment/Daemons @@ -22,19 +22,12 @@ Source2: rsyslog.conf Source3: rsyslog.sysconfig Source4: rsyslog.log # tweak the upstream service file to honour configuration from /etc/sysconfig/rsyslog -Patch0: rsyslog-7.2.2-systemd.patch +Patch0: rsyslog-7.4.1-sd-service.patch Patch1: rsyslog-7.2.2-manpage-dbg-mode.patch # prevent modification of trusted properties (proposed upstream) Patch2: rsyslog-7.2.1-msg_c_nonoverwrite_merge.patch # merged upstream Patch3: rsyslog-7.3.15-imuxsock-warning.patch -# merged upstream -Patch4: rsyslog-7.4.0-imjournal-segv.rhbz971471.patch -# merged upstream -Patch5: rsyslog-7.4.0-ratelimiter-loop.rhbz971471.patch -Patch6: rsyslog-7.4.0-ratelimiter-loop2.rhbz971471.patch -Patch7: rsyslog-7.4.0-ratelimiter-reset.patch -Patch8: rsyslog-7.4.0-no-ste-file-segv.patch BuildRequires: bison BuildRequires: flex @@ -42,7 +35,8 @@ BuildRequires: json-c-devel BuildRequires: libuuid-devel BuildRequires: pkgconfig BuildRequires: python-docutils -BuildRequires: systemd-devel >= 201 +# make sure systemd is in a version that isn't affected by rhbz#974132 +BuildRequires: systemd-devel >= 204-8 BuildRequires: zlib-devel Requires: logrotate >= 3.5.2 @@ -252,11 +246,6 @@ of source ports. %patch1 -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 %build %ifarch sparc64 @@ -334,7 +323,7 @@ install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/syslog # get rid of *.la rm -f %{buildroot}%{_libdir}/rsyslog/*.la # get rid of socket activation by default -sed -i '/^Sockets/s/^/;/;/^Alias/s/^/;/' %{buildroot}%{_unitdir}/rsyslog.service +sed -i '/^Alias/s/^/;/;/^Requires=syslog.socket/s/^/;/' %{buildroot}%{_unitdir}/rsyslog.service %post for n in /var/log/{messages,secure,maillog,spooler} @@ -478,6 +467,17 @@ done %{_libdir}/rsyslog/omudpspoof.so %changelog +* Mon Jun 17 2013 Tomas Heinrich 7.4.1-1 +- rebase to 7.4.1 + this release adds code that somewhat mitigates damage in cases + where large amounts of messages are received from systemd + journal (see rhbz#974132) +- regenerate patch 0 +- drop patches merged upstream: 4..8 +- add a dependency on the version of systemd which resolves the bug + mentioned above +- update option name in rsyslog.conf + * Tue Jun 12 2013 Tomas Heinrich 7.4.0-1 - rebase to 7.4.0 - drop autoconf automake libtool from BuildRequires diff --git a/sources b/sources index 0ef7f3c..e18d83a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -5bd05354331f4955337d8e4bc64db985 rsyslog-7.4.0.tar.gz +8e0e868a425bfa5c2c13bdc28338e1af rsyslog-7.4.1.tar.gz