summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-02-25 17:07:07 +0100
committerMichael Biebl <biebl@debian.org>2011-02-25 17:07:07 +0100
commit4f45cc34384973b3643148c21a5ede489ab05f86 (patch)
tree3ef7ec9f373a99ef2c7f0bbbfd017fb2abacde43
parent0116bd2a5f70ce1065933c47903a3bb4cd4fe9e0 (diff)
downloadrsyslog-4f45cc34384973b3643148c21a5ede489ab05f86.tar.gz
Imported Upstream version 5.7.6upstream/5.7.6
-rw-r--r--ChangeLog15
-rwxr-xr-xconfigure20
-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/queue.c5
-rw-r--r--runtime/ruleset.c23
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/Makefile.in17
-rw-r--r--tools/syslogd.c1
11 files changed, 71 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 09ccf46..0048c28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
---------------------------------------------------------------------------
+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 +102,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 b/configure
index 414b634..dbcb3de 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for rsyslog 5.7.5.
+# Generated by GNU Autoconf 2.65 for rsyslog 5.7.6.
#
# Report bugs to <rsyslog@lists.adiscon.com>.
#
@@ -701,8 +701,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rsyslog'
PACKAGE_TARNAME='rsyslog'
-PACKAGE_VERSION='5.7.5'
-PACKAGE_STRING='rsyslog 5.7.5'
+PACKAGE_VERSION='5.7.6'
+PACKAGE_STRING='rsyslog 5.7.6'
PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com'
PACKAGE_URL=''
@@ -1599,7 +1599,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures rsyslog 5.7.5 to adapt to many kinds of systems.
+\`configure' configures rsyslog 5.7.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1669,7 +1669,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of rsyslog 5.7.5:";;
+ short | recursive ) echo "Configuration of rsyslog 5.7.6:";;
esac
cat <<\_ACEOF
@@ -1836,7 +1836,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-rsyslog configure 5.7.5
+rsyslog configure 5.7.6
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2411,7 +2411,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by rsyslog $as_me 5.7.5, which was
+It was created by rsyslog $as_me 5.7.6, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -3219,7 +3219,7 @@ fi
# Define the identity of the package.
PACKAGE='rsyslog'
- VERSION='5.7.5'
+ VERSION='5.7.6'
cat >>confdefs.h <<_ACEOF
@@ -17018,7 +17018,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by rsyslog $as_me 5.7.5, which was
+This file was extended by rsyslog $as_me 5.7.6, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17084,7 +17084,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-rsyslog config.status 5.7.5
+rsyslog config.status 5.7.6
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index aac884e..09884b9 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.6],[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 c8988b1..966c172 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.6 (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 ff38852..7ee413e 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -606,7 +606,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];
@@ -630,11 +632,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 d0504f2..944889b 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/queue.c b/runtime/queue.c
index 76327f6..ef6e843 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 0584e8d..c9c64a3 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 f66270a..694b28a 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/Makefile.in b/tests/Makefile.in
index fcac8d8..503b686 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -45,7 +45,7 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ validation-run.sh imtcp-multiport.sh \
@ENABLE_TESTBENCH_TRUE@ daqueue-persist.sh diskqueue.sh \
@ENABLE_TESTBENCH_TRUE@ diskqueue-fsync.sh rulesetmultiqueue.sh \
-@ENABLE_TESTBENCH_TRUE@ manytcp.sh rsf_getenv.sh manyptcp.sh \
+@ENABLE_TESTBENCH_TRUE@ manytcp.sh rsf_getenv.sh \
@ENABLE_TESTBENCH_TRUE@ imtcp_conndrop.sh \
@ENABLE_TESTBENCH_TRUE@ imtcp_addtlframedelim.sh sndrcv.sh \
@ENABLE_TESTBENCH_TRUE@ sndrcv_gzip.sh sndrcv_udp.sh \
@@ -59,7 +59,7 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ dynfile_invld_sync.sh \
@ENABLE_TESTBENCH_TRUE@ dynfile_invalid2.sh complex1.sh \
@ENABLE_TESTBENCH_TRUE@ queue-persist.sh pipeaction.sh \
-@ENABLE_TESTBENCH_TRUE@ uxsock_simple.sh execonlyonce.sh \
+@ENABLE_TESTBENCH_TRUE@ execonlyonce.sh \
@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended.sh \
@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended2.sh \
@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended3.sh \
@@ -71,16 +71,19 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ imuxsock_ccmiddle_root.sh \
@ENABLE_TESTBENCH_TRUE@ queue-persist.sh $(am__append_1) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_2) $(am__append_3) \
-@ENABLE_TESTBENCH_TRUE@ $(am__append_4) $(am__append_5)
+@ENABLE_TESTBENCH_TRUE@ $(am__append_4) $(am__append_5) \
+@ENABLE_TESTBENCH_TRUE@ $(am__append_6)
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_1 = \
+@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ manyptcp.sh \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_large.sh \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_addtlframedelim.sh \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_conndrop.sh
-@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_2 = sndrcv_omudpspoof.sh \
+@ENABLE_OMUXSOCK_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_2 = uxsock_simple.sh
+@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_3 = sndrcv_omudpspoof.sh \
@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_omudpspoof_nonstdpt.sh
-@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_3 = omod-if-array.sh \
+@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_4 = omod-if-array.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ parsertest.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp.sh \
@@ -93,10 +96,10 @@ host_triplet = @host@
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ tabescape_off.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ fieldtest.sh
-@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_4 = omruleset.sh \
+@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_5 = omruleset.sh \
@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@ omruleset-queue.sh
-@ENABLE_EXTENDED_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_5 = random.sh
+@ENABLE_EXTENDED_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_6 = random.sh
subdir = tests
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
INSTALL
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 574c2ef..f7d71d0 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