summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog24
-rw-r--r--configure.ac2
-rw-r--r--doc/manual.html2
-rw-r--r--plugins/imuxsock/imuxsock.c4
-rw-r--r--runtime/batch.h8
-rw-r--r--runtime/msg.c3
-rw-r--r--runtime/queue.c5
-rw-r--r--runtime/ruleset.c23
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/testconfgen.c72
-rw-r--r--tools/syslogd.c1
11 files changed, 134 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 09ccf46b..4344535f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,22 @@
---------------------------------------------------------------------------
+Version 5.7.7 [V5-BETA] (rgerhards), 2011-03-02
+- bugfix: potential abort condition when $RepeatedMsgReduction set to on
+ as well as potentially in a number of other places where MsgDup() was
+ used. This only happened when the imudp input module was used and it
+ depended on name resolution not yet had taken place. In other words,
+ this was a strange problem that could lead to hard to diagnose
+ instability. So if you experience instability, chances are good that
+ this fix will help.
+---------------------------------------------------------------------------
+Version 5.7.6 [V5-BETA] (rgerhards), 2011-02-25
+- bugfix: fixed a memory leak and potential abort condition
+ this could happen if multiple rulesets were used and some output batches
+ contained messages belonging to more than one ruleset.
+ fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=226
+ fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218
+- bugfix: memory leak when $RepeatedMsgReduction on was used
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225
+---------------------------------------------------------------------------
Version 5.7.5 [V5-BETA] (rgerhards), 2011-02-23
- enhance: imfile did not yet support multiple rulesets, now added
we do this directly in the beta because a) it does not affect existing
@@ -93,8 +111,12 @@ Version 5.7.0 [V5-DEVEL] (rgerhards), 2010-09-16
thanks to Lennart Poettering for this patch
* sd-systemd API added as part of rsyslog runtime library
---------------------------------------------------------------------------
+Version 5.6.4 [V5-STABLE] (rgerhards), 2011-02-25
+- bugfix: memory leak when $RepeatedMsgReduction on was used
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225
+---------------------------------------------------------------------------
Version 5.6.3 [V5-STABLE] (rgerhards), 2011-01-26
-- bugfix: action processor released mememory too early, resulting in
+- bugfix: action processor released memory too early, resulting in
potential issue in retry cases (but very unlikely due to another
bug, which I also fixed -- only after the fix this problem here
became actually visible).
diff --git a/configure.ac b/configure.ac
index aac884e2..278288e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([rsyslog],[5.7.5],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[5.7.7],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
diff --git a/doc/manual.html b/doc/manual.html
index c8988b1a..48ff5e16 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -19,7 +19,7 @@ rsyslog support</a> available directly from the source!</p>
<p><b>Please visit the <a href="http://www.rsyslog.com/sponsors">rsyslog sponsor's page</a>
to honor the project sponsors or become one yourself!</b> We are very grateful for any help towards the
project goals.</p>
-<p><b>This documentation is for version 5.7.5 (beta branch) of rsyslog.</b>
+<p><b>This documentation is for version 5.7.7 (beta branch) of rsyslog.</b>
Visit the <i><a href="http://www.rsyslog.com/status">rsyslog status page</a></i></b>
to obtain current version information and project status.
</p><p><b>If you like rsyslog, you might
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 40f32e4a..86393ba6 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -607,7 +607,9 @@ static rsRetVal readSocket(lstn_t *pLstn)
int iMaxLine;
struct msghdr msgh;
struct iovec msgiov;
+# if HAVE_SCM_CREDENTIALS
struct cmsghdr *cm;
+# endif
struct ucred *cred;
uchar bufRcv[4096+1];
char aux[128];
@@ -631,11 +633,13 @@ static rsRetVal readSocket(lstn_t *pLstn)
memset(&msgh, 0, sizeof(msgh));
memset(&msgiov, 0, sizeof(msgiov));
+# if HAVE_SCM_CREDENTIALS
if(pLstn->bUseCreds) {
memset(&aux, 0, sizeof(aux));
msgh.msg_control = aux;
msgh.msg_controllen = sizeof(aux);
}
+# endif
msgiov.iov_base = pRcv;
msgiov.iov_len = iMaxLine;
msgh.msg_iov = &msgiov;
diff --git a/runtime/batch.h b/runtime/batch.h
index d0504f2b..944889bd 100644
--- a/runtime/batch.h
+++ b/runtime/batch.h
@@ -136,11 +136,16 @@ batchIsValidElem(batch_t *pBatch, int i) {
/* copy one batch element to another.
* This creates a complete duplicate in those cases where
* it is needed. Use duplication only when absolutely necessary!
+ * Note that all working fields are reset to zeros. If that were
+ * not done, we would have potential problems with invalid
+ * or double pointer frees.
* rgerhards, 2010-06-10
*/
static inline void
batchCopyElem(batch_obj_t *pDest, batch_obj_t *pSrc) {
- memcpy(pDest, pSrc, sizeof(batch_obj_t));
+ memset(pDest, 0, sizeof(batch_obj_t));
+ pDest->pUsrp = pSrc->pUsrp;
+ pDest->state = pSrc->state;
}
@@ -171,6 +176,7 @@ batchFree(batch_t *pBatch) {
static inline rsRetVal
batchInit(batch_t *pBatch, int maxElem) {
DEFiRet;
+ pBatch->iDoneUpTo = 0;
pBatch->maxElem = maxElem;
CHKmalloc(pBatch->pElem = calloc((size_t)maxElem, sizeof(batch_obj_t)));
// TODO: replace calloc by inidividual writes?
diff --git a/runtime/msg.c b/runtime/msg.c
index fb4d5742..b0261faa 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -932,13 +932,14 @@ msg_t* MsgDup(msg_t* pOld)
pNew->iLenMSG = pOld->iLenMSG;
pNew->iLenTAG = pOld->iLenTAG;
pNew->iLenHOSTNAME = pOld->iLenHOSTNAME;
- if((pOld->msgFlags & NEEDS_DNSRESOL) == 1) {
+ if((pOld->msgFlags & NEEDS_DNSRESOL)) {
localRet = msgSetFromSockinfo(pNew, pOld->rcvFrom.pfrominet);
if(localRet != RS_RET_OK) {
/* if something fails, we accept loss of this property, it is
* better than losing the whole message.
*/
pNew->msgFlags &= ~NEEDS_DNSRESOL;
+ pNew->rcvFrom.pRcvFrom = NULL; /* make sure no dangling values */
}
} else {
if(pOld->rcvFrom.pRcvFrom != NULL) {
diff --git a/runtime/queue.c b/runtime/queue.c
index 76327f6a..ef6e843b 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -842,6 +842,7 @@ static rsRetVal qAddDirect(qqueue_t *pThis, void* pUsr)
{
batch_t singleBatch;
batch_obj_t batchObj;
+ int i;
DEFiRet;
//TODO: init batchObj (states _OK and new fields -- CHECK)
@@ -863,6 +864,10 @@ static rsRetVal qAddDirect(qqueue_t *pThis, void* pUsr)
singleBatch.nElem = 1; /* there always is only one in direct mode */
singleBatch.pElem = &batchObj;
iRet = pThis->pConsumer(pThis->pUsr, &singleBatch, &pThis->bShutdownImmediate);
+ /* delete the batch string params: TODO: create its own "class" for this */
+ for(i = 0 ; i < CONF_OMOD_NUMSTRINGS_MAXSIZE ; ++i) {
+ free(batchObj.staticActStrings[i]);
+ }
objDestruct(pUsr);
RETiRet;
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index 0584e8d6..c9c64a38 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -171,35 +171,40 @@ processBatchMultiRuleset(batch_t *pBatch)
int i;
int iStart; /* start index of partial batch */
int iNew; /* index for new (temporary) batch */
+ int bHaveUnprocessed; /* do we (still) have unprocessed entries? (loop term predicate) */
DEFiRet;
- CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem));
- snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImmediate;
-
- while(1) { /* loop broken inside */
+ do {
+ bHaveUnprocessed = 0;
/* search for first unprocessed element */
for(iStart = 0 ; iStart < pBatch->nElem && pBatch->pElem[iStart].state == BATCH_STATE_DISC ; ++iStart)
/* just search, no action */;
-
if(iStart == pBatch->nElem)
- FINALIZE; /* everything processed */
+ break; /* everything processed */
/* prepare temporary batch */
+ CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem));
+ snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImmediate;
currRuleset = batchElemGetRuleset(pBatch, iStart);
iNew = 0;
for(i = iStart ; i < pBatch->nElem ; ++i) {
if(batchElemGetRuleset(pBatch, i) == currRuleset) {
- batchCopyElem(&(snglRuleBatch.pElem[iNew++]), &(pBatch->pElem[i]));
+ /* for performance reasons, we copy only those members that we actually need */
+ snglRuleBatch.pElem[iNew].pUsrp = pBatch->pElem[i].pUsrp;
+ snglRuleBatch.pElem[iNew].state = pBatch->pElem[i].state;
+ ++iNew;
/* We indicate the element also as done, so it will not be processed again */
pBatch->pElem[i].state = BATCH_STATE_DISC;
+ } else {
+ bHaveUnprocessed = 1;
}
}
snglRuleBatch.nElem = iNew; /* was left just right by the for loop */
batchSetSingleRuleset(&snglRuleBatch, 1);
/* process temp batch */
processBatch(&snglRuleBatch);
- }
- batchFree(&snglRuleBatch);
+ batchFree(&snglRuleBatch);
+ } while(bHaveUnprocessed == 1);
finalize_it:
RETiRet;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f66270ab..694b28ab 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,7 +13,6 @@ TESTS = $(TESTRUNS) cfg.sh \
rulesetmultiqueue.sh \
manytcp.sh \
rsf_getenv.sh \
- manyptcp.sh \
imtcp_conndrop.sh \
imtcp_addtlframedelim.sh \
sndrcv.sh \
@@ -37,7 +36,6 @@ TESTS = $(TESTRUNS) cfg.sh \
complex1.sh \
queue-persist.sh \
pipeaction.sh \
- uxsock_simple.sh \
execonlyonce.sh \
execonlywhenprevsuspended.sh \
execonlywhenprevsuspended2.sh \
@@ -53,11 +51,16 @@ TESTS = $(TESTRUNS) cfg.sh \
if ENABLE_IMPTCP
TESTS += \
+ manyptcp.sh \
imptcp_large.sh \
imptcp_addtlframedelim.sh \
imptcp_conndrop.sh
endif
+if ENABLE_OMUXSOCK
+TESTS += uxsock_simple.sh
+endif
+
if ENABLE_OMUDPSPOOF
TESTS += sndrcv_omudpspoof.sh \
sndrcv_omudpspoof_nonstdpt.sh
diff --git a/tests/testconfgen.c b/tests/testconfgen.c
new file mode 100644
index 00000000..9f191cc7
--- /dev/null
+++ b/tests/testconfgen.c
@@ -0,0 +1,72 @@
+/* a testcase generator
+ * THis program reads stdin, which must consist of (name,stmt) tupels
+ * where name is a part of the config name (small!) and stmt is an actual
+ * config statement. These tupels must be encoded as
+ * name<SP>stmt<LF>
+ * on stdin. After all tupels are read, the power set of all possible
+ * configurations is generated.
+ * Copyright (C) 2011 by Rainer Gerhards and Adiscon GmbH
+ * Released under the GPLv3 as part of the rsyslog project.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int arr[128];
+static char *name[128];
+static char *stmt[128];
+
+void output(int n)
+{
+ int i;
+
+ printf("name:");
+ for(i = 0 ; i < n ; ++i) {
+ if(arr[i]) {
+ printf("-%s", name[i]);
+ }
+ }
+ printf("\n");
+}
+
+void pows(int n, int i)
+{
+ if(i == 0) {
+ output(n);
+ } else {
+ --i;
+ arr[i] = 0;
+ pows(n, i);
+ arr[i] = 1;
+ pows(n, i);
+ }
+}
+
+
+int main(int argc, char *argv[])
+{
+ int n;
+ char iname[512];
+ char istmt[2048];
+ int nscanned;
+
+ n = 0;
+ while(!feof(stdin)) {
+ nscanned = scanf("%s %[^\n]s\n", iname, istmt);
+ if(nscanned == EOF)
+ break;
+ else if(nscanned != 2) {
+ fprintf(stderr, "problem scanning entry %d, scanned %d\n",
+ n, nscanned);
+ exit(1);
+ }
+ name[n] = strdup(iname);
+ stmt[n] = strdup(istmt);
+ n++;
+ printf("name: %s, stmt: %s\n", iname, istmt);
+ }
+ /* n is on to high for an index, but just right as the actual number! */
+
+ printf("read %d entries\n", n);
+ pows(n, n);
+}
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 574c2efa..f7d71d06 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -699,7 +699,6 @@ msgConsumer(void __attribute__((unused)) *notNeeded, batch_t *pBatch, int *pbShu
assert(pBatch != NULL);
pBatch->pbShutdownImmediate = pbShutdownImmediate; /* TODO: move this to batch creation! */
preprocessBatch(pBatch);
-//pBatch->bSingleRuleset = 0; // TODO: testing aid, remove!!!!
ruleset.ProcessBatch(pBatch);
//TODO: the BATCH_STATE_COMM must be set somewhere down the road, but we
//do not have this yet and so we emulate -- 2010-06-10