[rsyslog/f19] Add two patches for imjournal and the ratelimiter
Tomas Heinrich
theinric at fedoraproject.org
Wed Jun 12 21:59:51 UTC 2013
commit 412f35fa7566beef6f40219fdcfb62b1fc0816c5
Author: Tomas Heinrich <theinric at redhat.com>
Date: Wed Jun 12 23:14:55 2013 +0200
Add two patches for imjournal and the ratelimiter
rsyslog-7.4.0-no-ste-file-segv.patch | 87 +++++++++++++++++++++++++++++++++
rsyslog-7.4.0-ratelimiter-reset.patch | 27 ++++++++++
rsyslog.spec | 8 +++-
3 files changed, 121 insertions(+), 1 deletions(-)
---
diff --git a/rsyslog-7.4.0-no-ste-file-segv.patch b/rsyslog-7.4.0-no-ste-file-segv.patch
new file mode 100644
index 0000000..36668ed
--- /dev/null
+++ b/rsyslog-7.4.0-no-ste-file-segv.patch
@@ -0,0 +1,87 @@
+From ad9108eaf9164225f9149ed2b3b5c3184e1cb487 Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich <theinric at redhat.com>
+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-reset.patch b/rsyslog-7.4.0-ratelimiter-reset.patch
new file mode 100644
index 0000000..bc7bacb
--- /dev/null
+++ b/rsyslog-7.4.0-ratelimiter-reset.patch
@@ -0,0 +1,27 @@
+From 489541d2a901c5fedd9cbbdc8ad0df557fdabddd Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich <theinric at redhat.com>
+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.spec b/rsyslog.spec
index 3e42355..0428bde 100644
--- a/rsyslog.spec
+++ b/rsyslog.spec
@@ -33,6 +33,8 @@ 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
@@ -253,6 +255,8 @@ of source ports.
%patch4 -p1
%patch5 -p1
%patch6 -p1
+%patch7 -p1
+%patch8 -p1
%build
%ifarch sparc64
@@ -474,7 +478,7 @@ done
%{_libdir}/rsyslog/omudpspoof.so
%changelog
-* Tue Jun 11 2013 Tomas Heinrich <theinric at redhat.com> 7.4.0-1
+* Wed Jun 12 2013 Tomas Heinrich <theinric at redhat.com> 7.4.0-1
- rebase to 7.4.0
- drop patch 5 - fixed upstream
- drop the imkmsg plugin
@@ -494,6 +498,8 @@ done
systemd journal
- add a patch to prevent an endless loop in the ratelimiter
- add a patch to prevent another endless loop in the ratelimiter
+- add a patch to prevent a segfault in imjournal for undefined state file
+- add a patch to correctly reset state in the ratelimiter
* Wed Apr 03 2013 Tomas Heinrich <theinric at redhat.com> 7.2.6-1
- rebase to 7.2.6
More information about the scm-commits
mailing list