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
This commit is contained in:
Tomas Heinrich 2013-06-17 15:21:13 +02:00
parent 9c292afab3
commit 103b4cae5f
10 changed files with 32 additions and 234 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ rsyslog-4.6.3.tar.gz
/rsyslog-7.3.10.tar.gz /rsyslog-7.3.10.tar.gz
/rsyslog-7.3.15-20130604git6e72fa6.tar.gz /rsyslog-7.3.15-20130604git6e72fa6.tar.gz
/rsyslog-7.4.0.tar.gz /rsyslog-7.4.0.tar.gz
/rsyslog-7.4.1.tar.gz

View File

@ -1,35 +0,0 @@
From 0082647fa5e6849b83ab4c6b9ab2e8803245db14 Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@redhat.com>
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

View File

@ -1,87 +0,0 @@
From ad9108eaf9164225f9149ed2b3b5c3184e1cb487 Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@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

View File

@ -1,38 +0,0 @@
From f11a873dc4e258c346765af9d5d23a1180493ee8 Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@redhat.com>
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

View File

@ -1,29 +0,0 @@
From 82db8e6fbba89bf486cc7e642e4f8daaa43852e8 Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@redhat.com>
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

View File

@ -1,27 +0,0 @@
From 489541d2a901c5fedd9cbbdc8ad0df557fdabddd Mon Sep 17 00:00:00 2001
From: Tomas Heinrich <theinric@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

View File

@ -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]

View File

@ -40,7 +40,7 @@ $IncludeConfig /etc/rsyslog.d/*.conf
$OmitLocalLogging on $OmitLocalLogging on
# File to store the position in the journal # File to store the position in the journal
$StateFile imjournal.state $IMJournalStateFile imjournal.state
#### RULES #### #### RULES ####

View File

@ -12,7 +12,7 @@
Summary: Enhanced system logging and kernel message trapping daemon Summary: Enhanced system logging and kernel message trapping daemon
Name: rsyslog Name: rsyslog
Version: 7.4.0 Version: 7.4.1
Release: 1%{?dist} Release: 1%{?dist}
License: (GPLv3+ and ASL 2.0) License: (GPLv3+ and ASL 2.0)
Group: System Environment/Daemons Group: System Environment/Daemons
@ -22,19 +22,12 @@ Source2: rsyslog.conf
Source3: rsyslog.sysconfig Source3: rsyslog.sysconfig
Source4: rsyslog.log Source4: rsyslog.log
# tweak the upstream service file to honour configuration from /etc/sysconfig/rsyslog # 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 Patch1: rsyslog-7.2.2-manpage-dbg-mode.patch
# prevent modification of trusted properties (proposed upstream) # prevent modification of trusted properties (proposed upstream)
Patch2: rsyslog-7.2.1-msg_c_nonoverwrite_merge.patch Patch2: rsyslog-7.2.1-msg_c_nonoverwrite_merge.patch
# merged upstream # merged upstream
Patch3: rsyslog-7.3.15-imuxsock-warning.patch 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: bison
BuildRequires: flex BuildRequires: flex
@ -42,7 +35,8 @@ BuildRequires: json-c-devel
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: python-docutils 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 BuildRequires: zlib-devel
Requires: logrotate >= 3.5.2 Requires: logrotate >= 3.5.2
@ -252,11 +246,6 @@ of source ports.
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build %build
%ifarch sparc64 %ifarch sparc64
@ -334,7 +323,7 @@ install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/syslog
# get rid of *.la # get rid of *.la
rm -f %{buildroot}%{_libdir}/rsyslog/*.la rm -f %{buildroot}%{_libdir}/rsyslog/*.la
# get rid of socket activation by default # 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 %post
for n in /var/log/{messages,secure,maillog,spooler} for n in /var/log/{messages,secure,maillog,spooler}
@ -478,6 +467,17 @@ done
%{_libdir}/rsyslog/omudpspoof.so %{_libdir}/rsyslog/omudpspoof.so
%changelog %changelog
* Mon Jun 17 2013 Tomas Heinrich <theinric@redhat.com> 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 <theinric@redhat.com> 7.4.0-1 * Tue Jun 12 2013 Tomas Heinrich <theinric@redhat.com> 7.4.0-1
- rebase to 7.4.0 - rebase to 7.4.0
- drop autoconf automake libtool from BuildRequires - drop autoconf automake libtool from BuildRequires

View File

@ -1 +1 @@
5bd05354331f4955337d8e4bc64db985 rsyslog-7.4.0.tar.gz 8e0e868a425bfa5c2c13bdc28338e1af rsyslog-7.4.1.tar.gz