diff --git a/backport-Do-not-free-the-uninitialized-cstring.patch b/backport-Do-not-free-the-uninitialized-cstring.patch new file mode 100644 index 0000000000000000000000000000000000000000..c2d436ea097ca54d8a0d06f27c7f66f6acd23ad7 --- /dev/null +++ b/backport-Do-not-free-the-uninitialized-cstring.patch @@ -0,0 +1,44 @@ +From 7d8519c92d55f073b4a6cc57e27ea34b5c4dc5d1 Mon Sep 17 00:00:00 2001 +From: Flos Lonicerae +Date: Fri, 19 Apr 2024 16:55:55 +0800 +Subject: [PATCH] Do not free the uninitialized cstring. + + * Better deal with corrupted queue messages +--- + runtime/obj.c | 6 +++++- + runtime/stringbuf.c | 2 +- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/runtime/obj.c b/runtime/obj.c +index c78b1d27a..03a56f7a3 100644 +--- a/runtime/obj.c ++++ b/runtime/obj.c +@@ -518,7 +518,11 @@ static rsRetVal objDeserializeStr(cstr_t **ppCStr, int iLen, strm_t *pStrm) + cstrFinalize(pCStr); + + /* check terminator */ +- if(c != ':') ABORT_FINALIZE(RS_RET_INVALID_DELIMITER); ++ if(c != ':') { ++ /* Initialized to NULL */ ++ *ppCStr = NULL; ++ ABORT_FINALIZE(RS_RET_INVALID_DELIMITER); ++ } + + *ppCStr = pCStr; + +diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c +index ea39b7c82..9c639a04e 100644 +--- a/runtime/stringbuf.c ++++ b/runtime/stringbuf.c +@@ -219,7 +219,7 @@ finalize_it: + + void rsCStrDestruct(cstr_t **const ppThis) + { +- free((*ppThis)->pBuf); ++ if ((*ppThis)->pBuf) free((*ppThis)->pBuf); + RSFREEOBJ(*ppThis); + *ppThis = NULL; + } +-- +2.33.0 + diff --git a/backport-Fix-legacy-ActionQueueDiscardMark-parameter.patch b/backport-Fix-legacy-ActionQueueDiscardMark-parameter.patch new file mode 100644 index 0000000000000000000000000000000000000000..3064c8f7c483aff1ade4a8a75de42e6759ae7a32 --- /dev/null +++ b/backport-Fix-legacy-ActionQueueDiscardMark-parameter.patch @@ -0,0 +1,46 @@ +From 2feac271cadb4cc915aa279ec1986fc2d7b8c4b0 Mon Sep 17 00:00:00 2001 +From: Cropi +Date: Tue, 26 Nov 2024 13:13:28 +0100 +Subject: [PATCH] Fix legacy $ActionQueueDiscardMark parameter + +If the $ActionQueueSize legacy parameter was configured +with a much value higher than the default, the queueDiscardMark +option was not automatically adjusted to represent 98% of +the actual queue size. This caused a misalignment issue, +which does not occur when using the RainerScript syntax. + +Fixes #5399 +--- + action.c | 2 +- + runtime/rsconf.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/action.c b/action.c +index 5e94ed207..e377c7420 100644 +--- a/action.c ++++ b/action.c +@@ -291,7 +291,7 @@ actionResetQueueParams(void) + cs.iActionQueueDeqBatchSize = 16; /* default batch size */ + cs.iActionQHighWtrMark = -1; /* high water mark for disk-assisted queues */ + cs.iActionQLowWtrMark = -1; /* low water mark for disk-assisted queues */ +- cs.iActionQDiscardMark = 980; /* begin to discard messages */ ++ cs.iActionQDiscardMark = -1; /* begin to discard messages */ + cs.iActionQDiscardSeverity = 8; /* discard warning and above */ + cs.iActionQueueNumWorkers = 1; /* number of worker threads for the mm queue above */ + cs.iActionQueMaxFileSize = 1024*1024; +diff --git a/runtime/rsconf.c b/runtime/rsconf.c +index 68a4de4e0..71b31be3c 100644 +--- a/runtime/rsconf.c ++++ b/runtime/rsconf.c +@@ -246,7 +246,7 @@ static void cnfSetDefaults(rsconf_t *pThis) + pThis->globals.mainQ.iMainMsgQueueSize = 100000; + pThis->globals.mainQ.iMainMsgQHighWtrMark = 80000; + pThis->globals.mainQ.iMainMsgQLowWtrMark = 20000; +- pThis->globals.mainQ.iMainMsgQDiscardMark = 98000; ++ pThis->globals.mainQ.iMainMsgQDiscardMark = -1; + pThis->globals.mainQ.iMainMsgQDiscardSeverity = 8; + pThis->globals.mainQ.iMainMsgQueueNumWorkers = 2; + pThis->globals.mainQ.MainMsgQueType = QUEUETYPE_FIXED_ARRAY; +-- +2.33.0 + diff --git a/backport-Fix-passing-the-value-to-EscapeChar.patch b/backport-Fix-passing-the-value-to-EscapeChar.patch new file mode 100644 index 0000000000000000000000000000000000000000..756544c368efd3d871dde0018703f3f53c499a51 --- /dev/null +++ b/backport-Fix-passing-the-value-to-EscapeChar.patch @@ -0,0 +1,34 @@ +From 8f203bb219e08ec2e685d190ea21d5a7c7cecf44 Mon Sep 17 00:00:00 2001 +From: Flos Lonicerae +Date: Wed, 8 May 2024 16:45:39 +0800 +Subject: [PATCH] Fix passing the value to EscapeChar. + +--- + runtime/cfsysline.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/runtime/cfsysline.c b/runtime/cfsysline.c +index 34b1cd7a3..06fdb4bb0 100644 +--- a/runtime/cfsysline.c ++++ b/runtime/cfsysline.c +@@ -59,7 +59,7 @@ linkedList_t llCmdList; /* this is NOT a pointer - no typo here ;) */ + * HINT: check if char is ' and, if so, use 'c' where c may also be things + * like \t etc. + */ +-static rsRetVal doGetChar(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *pVal) ++static rsRetVal doGetChar(uchar **pp, rsRetVal (*pSetHdlr)(void*, uchar*), void *pVal) + { + DEFiRet; + +@@ -78,7 +78,7 @@ static rsRetVal doGetChar(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void * + *((uchar*)pVal) = **pp; + } else { + /* we set value via a set function */ +- CHKiRet(pSetHdlr(pVal, **pp)); ++ CHKiRet(pSetHdlr(pVal, *pp)); + } + ++(*pp); /* eat processed char */ + } +-- +2.33.0 + diff --git a/backport-Fix-runConf-NULL-pointer-refence.patch b/backport-Fix-runConf-NULL-pointer-refence.patch new file mode 100644 index 0000000000000000000000000000000000000000..967ab4a10b2563538af35e6a4f82380f7d0dda64 --- /dev/null +++ b/backport-Fix-runConf-NULL-pointer-refence.patch @@ -0,0 +1,29 @@ +From d38e4b7bfc5bd0137914859837dcc04076b9e1ea Mon Sep 17 00:00:00 2001 +From: Wang Haitao <45086632+apple-ouyang@users.noreply.github.com> +Date: Fri, 20 Sep 2024 17:50:37 +0800 +Subject: [PATCH] Fix runConf NULL pointer refence + +`systemd restart rsyslog` in the early start of OS will let rsyslog segmentation fault. +This cmd will send sigTerm to rsylogd, and rsyslogd will handle the signal in rsyslogdDoDie. +If the rsyslogd havn't parse the conf, the runConf will be NULL +So check the pointer before reference it. +--- + tools/rsyslogd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c +index ed81df3a7..1340b1e62 100644 +--- a/tools/rsyslogd.c ++++ b/tools/rsyslogd.c +@@ -2013,7 +2013,7 @@ rsyslogdDoDie(int sig) + abort(); + } + bFinished = sig; +- if(runConf->globals.debugOnShutdown) { ++ if(runConf && runConf->globals.debugOnShutdown) { + /* kind of hackish - set to 0, so that debug_swith will enable + * and AND emit the "start debug log" message. + */ +-- +2.33.0 + diff --git a/backport-Keep-original-free-pattern.patch b/backport-Keep-original-free-pattern.patch new file mode 100644 index 0000000000000000000000000000000000000000..8880e8ad6232c3c3103335b4b4abccf62dbf27df --- /dev/null +++ b/backport-Keep-original-free-pattern.patch @@ -0,0 +1,25 @@ +From 24f7a56dd95851f0417abc256281f641aaace2cc Mon Sep 17 00:00:00 2001 +From: Flos Lonicerae +Date: Wed, 1 May 2024 18:00:46 +0800 +Subject: [PATCH] Keep original free pattern. + +--- + runtime/stringbuf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c +index 9c639a04e..ea39b7c82 100644 +--- a/runtime/stringbuf.c ++++ b/runtime/stringbuf.c +@@ -219,7 +219,7 @@ finalize_it: + + void rsCStrDestruct(cstr_t **const ppThis) + { +- if ((*ppThis)->pBuf) free((*ppThis)->pBuf); ++ free((*ppThis)->pBuf); + RSFREEOBJ(*ppThis); + *ppThis = NULL; + } +-- +2.33.0 + diff --git a/backport-network-subsystem-improve-connection-failure-error-m.patch b/backport-network-subsystem-improve-connection-failure-error-m.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ae66f7dbb3045e3656d8e0bb4fc9cb80fa1693a --- /dev/null +++ b/backport-network-subsystem-improve-connection-failure-error-m.patch @@ -0,0 +1,54 @@ +From 9ac56b28614f1bdbe147181471a6688f4f418e9f Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Sun, 15 Sep 2024 15:24:28 +0200 +Subject: [PATCH] network subsystem: improve connection failure error message + +If we try to connect via TCP and the connections fails, we now +tell inside the error message how long the connection attempt +took. This is useful to find out if targets connect very +slowly. +--- + runtime/nsd_ptcp.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c +index e1c1de957..8549d5aaa 100644 +--- a/runtime/nsd_ptcp.c ++++ b/runtime/nsd_ptcp.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include "rsyslog.h" + #include "syslogd-types.h" +@@ -73,6 +74,7 @@ DEFobjCurrIf(prop) + static void + sockClose(int *pSock) + { ++ fprintf(stderr, "nsd_ptcp: closing socket %d\n", *pSock); + if(*pSock >= 0) { + close(*pSock); + *pSock = -1; +@@ -956,9 +958,15 @@ Connect(nsd_t *pNsd, int family, uchar *port, uchar *host, char *device) + } + } + ++ struct timeval start, end; ++ long seconds, useconds; ++ gettimeofday(&start, NULL); + if(connect(pThis->sock, res->ai_addr, res->ai_addrlen) != 0) { +- LogError(errno, RS_RET_IO_ERROR, "cannot connect to %s:%s", +- host, port); ++ gettimeofday(&end, NULL); ++ seconds = end.tv_sec - start.tv_sec; ++ useconds = end.tv_usec - start.tv_usec; ++ LogError(errno, RS_RET_IO_ERROR, "cannot connect to %s:%s (took %ld.%ld seconds)", ++ host, port, seconds, useconds / 10000); + ABORT_FINALIZE(RS_RET_IO_ERROR); + } + +-- +2.33.0 + diff --git a/backport-nsd_ptcp-regression-fix-remove-debugging-messages-em.patch b/backport-nsd_ptcp-regression-fix-remove-debugging-messages-em.patch new file mode 100644 index 0000000000000000000000000000000000000000..0130a3fde0f5e6341e3e8c0583c5baf26bcbd8a3 --- /dev/null +++ b/backport-nsd_ptcp-regression-fix-remove-debugging-messages-em.patch @@ -0,0 +1,29 @@ +From 9bc4c49d0705db2656a56fe14a5a2cfe3f6c9ac2 Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Tue, 12 Nov 2024 10:54:00 +0100 +Subject: [PATCH] nsd_ptcp regression fix: remove debugging messages emited to + stderr + +fix regression introduced by 9ac56b286. This spits out a debug message +to stderr. That message is removed by this patch here. + +closes https://github.com/rsyslog/rsyslog/issues/5485 +--- + runtime/nsd_ptcp.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c +index 8549d5aaa..240482b72 100644 +--- a/runtime/nsd_ptcp.c ++++ b/runtime/nsd_ptcp.c +@@ -74,7 +74,6 @@ DEFobjCurrIf(prop) + static void + sockClose(int *pSock) + { +- fprintf(stderr, "nsd_ptcp: closing socket %d\n", *pSock); + if(*pSock >= 0) { + close(*pSock); + *pSock = -1; +-- +2.33.0 + diff --git a/backport-rainerscript-do-not-try-to-call-a-function-if-it-doe.patch b/backport-rainerscript-do-not-try-to-call-a-function-if-it-doe.patch new file mode 100644 index 0000000000000000000000000000000000000000..5cc911a1124208a2bab397475106bd4c71807a77 --- /dev/null +++ b/backport-rainerscript-do-not-try-to-call-a-function-if-it-doe.patch @@ -0,0 +1,47 @@ +From 3ccbc99a1bf6b2da543c9db9ac03aca2019fc50f Mon Sep 17 00:00:00 2001 +From: Cropi +Date: Wed, 25 Sep 2024 10:32:49 +0200 +Subject: [PATCH] rainerscript: do not try to call a function if it does not + exist + +--- + grammar/rainerscript.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c +index 69d0b38ba..db7edbb1e 100644 +--- a/grammar/rainerscript.c ++++ b/grammar/rainerscript.c +@@ -2901,11 +2901,6 @@ doFuncCall(struct cnffunc *__restrict__ const func, struct svar *__restrict__ co + free(fname); + } + if(func->fPtr == NULL) { +- char *fname = es_str2cstr(func->fname, NULL); +- LogError(0, RS_RET_INTERNAL_ERROR, +- "rainerscript: internal error: NULL pointer for function named '%s'\n", +- fname); +- free(fname); + ret->datatype = 'N'; + ret->d.n = 0; + } else { +@@ -3802,7 +3797,7 @@ cnffuncDestruct(struct cnffunc *func) + char *cstr = es_str2cstr(func->fname, NULL); + struct scriptFunct *foundFunc = searchModList(cstr); + free(cstr); +- if(foundFunc->destruct != NULL) { ++ if(foundFunc && foundFunc->destruct != NULL) { + foundFunc->destruct(func); + } + +@@ -5300,7 +5295,7 @@ cnffuncNew(es_str_t *fname, struct cnffparamlst* paramlst) + } + /* some functions require special initialization */ + struct scriptFunct *foundFunc = searchModList(cstr); +- if(foundFunc->initFunc != NULL) { ++ if(foundFunc && foundFunc->initFunc != NULL) { + foundFunc->initFunc(func); + } + free(cstr); +-- +2.33.0 + diff --git a/rsyslog.spec b/rsyslog.spec index dc3b3b028a28d5ee23ab8956bb820a9d3073098b..f10027ad5ea5114363883fe3fcd5051c947b6354 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -7,7 +7,7 @@ Name: rsyslog Version: 8.2312.0 -Release: 6 +Release: 7 Summary: The rocket-fast system for log processing License: (GPLv3+ and ASL 2.0) URL: http://www.rsyslog.com/ @@ -36,6 +36,15 @@ Patch6003: backport-fix-memory-leak-in-omazureeventhubs-on-accepted-PN_D.pa Patch9006: tls-bugfix-parameter-StreamDriver_CRLFile-not-known.patch +Patch6004: backport-Fix-passing-the-value-to-EscapeChar.patch +Patch6005: backport-Do-not-free-the-uninitialized-cstring.patch +Patch6006: backport-Keep-original-free-pattern.patch +Patch6007: backport-network-subsystem-improve-connection-failure-error-m.patch +Patch6008: backport-Fix-runConf-NULL-pointer-refence.patch +Patch6009: backport-rainerscript-do-not-try-to-call-a-function-if-it-doe.patch +Patch6010: backport-nsd_ptcp-regression-fix-remove-debugging-messages-em.patch +Patch6011: backport-Fix-legacy-ActionQueueDiscardMark-parameter.patch + BuildRequires: gcc autoconf automake bison dos2unix flex pkgconfig python3-docutils libtool BuildRequires: libgcrypt-devel libuuid-devel zlib-devel krb5-devel libnet-devel gnutls-devel BuildRequires: libfastjson-devel >= 0.99.8 libestr-devel >= 0.1.9 python-sphinx @@ -511,6 +520,19 @@ done %{_mandir}/man1/rscryutil.1.gz %changelog +* Sat Dec 21 2024 zhangqiumiao - 8.2312.0-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix passing the value to EscapeChar + Do not free the uninitialized cstring + Keep original free pattern + network subsystem: improve connection failure error message + Fix runConf NULL pointer refence + rainerscript: do not try to call a function if it does not exist + nsd_ptcp regression fix: remove debugging messages emited to stderr + Fix legacy $ActionQueueDiscardMark parameter + * Fri Aug 16 2024 zhangyaqi - 8.2312.0-6 - Type:bugfix - ID:NA