summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2017-09-05 10:25:21 +0300
committerMartin Jansa <Martin.Jansa@gmail.com>2017-09-07 10:57:39 +0200
commit7b7a49b1bae9204e7c8997e92ab5ccb076df9bc0 (patch)
treea6ccdd149d6fcdbb3d4616a1e4106d162b3ad081
parent142edc3f0654efe90a7951a0d911fc5b59bfa2a1 (diff)
downloadmeta-openembedded-7b7a49b1bae9204e7c8997e92ab5ccb076df9bc0.tar.gz
rsyslog: fix segfault after configuration errors
rsyslog will segfault on startup if a) the local machine's hostname is set to a non-FQDN name b) the getaddrinfo() system call fails This scenario is higly unlikely, but may exist especially with provisioned VMs which may not properly be able to do name queries on startup (seen for example on AWS). This patch fixes the situation and also provides more robustness for very early startup error messages when some of the error-reporting subsystem is not yet properly initialized. Note that under these circumstances, errors may only show up on stderr. closes https://github.com/rsyslog/rsyslog/issues/1573 Reference: https://github.com/rsyslog/rsyslog/issues/1573 Upstream patch: https://github.com/rsyslog/rsyslog/commit/6d258339802cb9f13d8a4a157a4b74eccb902d8f Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-oe/recipes-extended/rsyslog/rsyslog/0001-core-bugfix-segfault-after-configuration-errors.patch90
-rw-r--r--meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb1
2 files changed, 91 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0001-core-bugfix-segfault-after-configuration-errors.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0001-core-bugfix-segfault-after-configuration-errors.patch
new file mode 100644
index 000000000..189ca654a
--- /dev/null
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0001-core-bugfix-segfault-after-configuration-errors.patch
@@ -0,0 +1,90 @@
1From 6d258339802cb9f13d8a4a157a4b74eccb902d8f Mon Sep 17 00:00:00 2001
2From: Rainer Gerhards <rgerhards@adiscon.com>
3Date: Mon, 17 Jul 2017 15:36:32 +0200
4Subject: [PATCH] core bugfix: segfault after configuration errors
5
6rsyslog will segfault on startup if
7a) the local machine's hostname is set to a non-FQDN name
8b) the getaddrinfo() system call fails
9This scenario is higly unlikely, but may exist especially with
10provisioned VMs which may not properly be able to do name queries
11on startup (seen for example on AWS).
12
13This patch fixes the situation and also provides more robustness
14for very early startup error messages when some of the error-reporting
15subsystem is not yet properly initialized. Note that under these
16circumstances, errors may only show up on stderr.
17
18Upstream status: Backport
19
20closes https://github.com/rsyslog/rsyslog/issues/1573
21
22Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
23---
24 runtime/prop.c | 6 ++++++
25 tools/rsyslogd.c | 17 +++++++++--------
26 2 files changed, 15 insertions(+), 8 deletions(-)
27
28diff --git a/runtime/prop.c b/runtime/prop.c
29index e5b4693..cb93285 100644
30--- a/runtime/prop.c
31+++ b/runtime/prop.c
32@@ -133,7 +133,13 @@ propConstructFinalize(prop_t __attribute__((unused)) *pThis)
33 */
34 static rsRetVal AddRef(prop_t *pThis)
35 {
36+ if(pThis == NULL) {
37+ DBGPRINTF("prop/AddRef is passed a NULL ptr - ignoring it "
38+ "- further problems may occur\n");
39+ FINALIZE;
40+ }
41 ATOMIC_INC(&pThis->iRefCount, &pThis->mutRefCount);
42+finalize_it:
43 return RS_RET_OK;
44 }
45
46diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
47index 759d293..6aa1487 100644
48--- a/tools/rsyslogd.c
49+++ b/tools/rsyslogd.c
50@@ -808,9 +808,11 @@ logmsgInternal(int iErr, const syslog_pri_t pri, const uchar *const msg, int fla
51 * permits us to process unmodified config files which otherwise contain a
52 * supressor statement.
53 */
54- if(((Debug == DEBUG_FULL || !doFork) && ourConf->globals.bErrMsgToStderr) || iConfigVerify) {
55+ int emit_to_stderr = (ourConf == NULL) ? 1 : ourConf->globals.bErrMsgToStderr;
56+ if(((Debug == DEBUG_FULL || !doFork) && emit_to_stderr) || iConfigVerify) {
57 if(pri2sev(pri) == LOG_ERR)
58- fprintf(stderr, "rsyslogd: %s\n", (bufModMsg == NULL) ? (char*)msg : bufModMsg);
59+ fprintf(stderr, "rsyslogd: %s\n",
60+ (bufModMsg == NULL) ? (char*)msg : bufModMsg);
61 }
62
63 finalize_it:
64@@ -1115,18 +1117,17 @@ initAll(int argc, char **argv)
65
66 /* doing some core initializations */
67
68- /* get our host and domain names - we need to do this early as we may emit
69- * error log messages, which need the correct hostname. -- rgerhards, 2008-04-04
70- */
71- queryLocalHostname();
72-
73- /* initialize the objects */
74 if((iRet = modInitIminternal()) != RS_RET_OK) {
75 fprintf(stderr, "fatal error: could not initialize errbuf object (error code %d).\n",
76 iRet);
77 exit(1); /* "good" exit, leaving at init for fatal error */
78 }
79
80+ /* get our host and domain names - we need to do this early as we may emit
81+ * error log messages, which need the correct hostname. -- rgerhards, 2008-04-04
82+ * But we need to have imInternal up first!
83+ */
84+ queryLocalHostname();
85
86 /* END core initializations - we now come back to carrying out command line options*/
87
88--
892.10.2
90
diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb b/meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb
index bd317be64..597a0c8dc 100644
--- a/meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb
@@ -25,6 +25,7 @@ SRC_URI = "http://www.rsyslog.com/download/files/download/rsyslog/${BPN}-${PV}.t
25 file://run-ptest \ 25 file://run-ptest \
26 file://rsyslog-fix-ptest-not-finish.patch \ 26 file://rsyslog-fix-ptest-not-finish.patch \
27 file://CVE-2017-12588.patch \ 27 file://CVE-2017-12588.patch \
28 file://0001-core-bugfix-segfault-after-configuration-errors.patch \
28" 29"
29 30
30SRC_URI_append_libc-musl = " \ 31SRC_URI_append_libc-musl = " \