diff options
-rw-r--r-- | meta-oe/recipes-extended/rsyslog/rsyslog/0001-core-bugfix-segfault-after-configuration-errors.patch | 90 | ||||
-rw-r--r-- | meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb | 1 |
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 @@ | |||
1 | From 6d258339802cb9f13d8a4a157a4b74eccb902d8f Mon Sep 17 00:00:00 2001 | ||
2 | From: Rainer Gerhards <rgerhards@adiscon.com> | ||
3 | Date: Mon, 17 Jul 2017 15:36:32 +0200 | ||
4 | Subject: [PATCH] core bugfix: segfault after configuration errors | ||
5 | |||
6 | rsyslog will segfault on startup if | ||
7 | a) the local machine's hostname is set to a non-FQDN name | ||
8 | b) the getaddrinfo() system call fails | ||
9 | This scenario is higly unlikely, but may exist especially with | ||
10 | provisioned VMs which may not properly be able to do name queries | ||
11 | on startup (seen for example on AWS). | ||
12 | |||
13 | This patch fixes the situation and also provides more robustness | ||
14 | for very early startup error messages when some of the error-reporting | ||
15 | subsystem is not yet properly initialized. Note that under these | ||
16 | circumstances, errors may only show up on stderr. | ||
17 | |||
18 | Upstream status: Backport | ||
19 | |||
20 | closes https://github.com/rsyslog/rsyslog/issues/1573 | ||
21 | |||
22 | Signed-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 | |||
28 | diff --git a/runtime/prop.c b/runtime/prop.c | ||
29 | index 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 | |||
46 | diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c | ||
47 | index 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 | -- | ||
89 | 2.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 | ||
30 | SRC_URI_append_libc-musl = " \ | 31 | SRC_URI_append_libc-musl = " \ |