summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2015-10-09 16:10:12 +0200
committerLars Wendler <polynomial-c@gentoo.org>2015-10-09 16:12:02 +0200
commitb2fc2901e8b2e08a19e8b2eca4b29c86e1a93e9b (patch)
tree98cdbc921d1b36d405d3cdc86167b85ad5f7bc7a /app-admin/rsyslog/files/8-stable/50-rsyslog-8.13.0-lookup-table-reload-bugfix.patch
parentpackage.mask: Removed dev-libs/liblognorm mask. (diff)
downloadgentoo-b2fc2901e8b2e08a19e8b2eca4b29c86e1a93e9b.tar.gz
gentoo-b2fc2901e8b2e08a19e8b2eca4b29c86e1a93e9b.tar.bz2
gentoo-b2fc2901e8b2e08a19e8b2eca4b29c86e1a93e9b.zip
app-admin/rsyslog: Bump to version 8.13.0
Package-Manager: portage-2.2.23 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Diffstat (limited to 'app-admin/rsyslog/files/8-stable/50-rsyslog-8.13.0-lookup-table-reload-bugfix.patch')
-rw-r--r--app-admin/rsyslog/files/8-stable/50-rsyslog-8.13.0-lookup-table-reload-bugfix.patch141
1 files changed, 141 insertions, 0 deletions
diff --git a/app-admin/rsyslog/files/8-stable/50-rsyslog-8.13.0-lookup-table-reload-bugfix.patch b/app-admin/rsyslog/files/8-stable/50-rsyslog-8.13.0-lookup-table-reload-bugfix.patch
new file mode 100644
index 000000000000..b42618048e88
--- /dev/null
+++ b/app-admin/rsyslog/files/8-stable/50-rsyslog-8.13.0-lookup-table-reload-bugfix.patch
@@ -0,0 +1,141 @@
+From 3a10a78edeef9725f69a24d633bb394e365145f0 Mon Sep 17 00:00:00 2001
+From: Janmejay Singh <singh.janmejay@gmail.com>
+Date: Wed, 30 Sep 2015 17:24:38 +0530
+Subject: [PATCH] Fixed lookup-table reload bug, which ignored table-length of
+ reloaded table, resulting in additional entries being invisible while
+ looking-up (binary-search would work with old-table-length). This would be a
+ security-issue or may cause a crash if reloaded table is actually smaller
+ (memory access beyond table).
+
+---
+ runtime/lookup.c | 1 +
+ tests/Makefile.am | 5 +++++
+ tests/diag.sh | 4 ++++
+ tests/lookup_table.sh | 24 ++++++++++++++++++++++++
+ tests/testsuites/lookup_table.conf | 9 +++++++++
+ tests/testsuites/xlate.lkp_tbl | 5 +++++
+ tests/testsuites/xlate_more.lkp_tbl | 6 ++++++
+ 7 files changed, 55 insertions(+)
+ create mode 100755 tests/lookup_table.sh
+ create mode 100644 tests/testsuites/lookup_table.conf
+ create mode 100644 tests/testsuites/xlate.lkp_tbl
+ create mode 100644 tests/testsuites/xlate_more.lkp_tbl
+
+diff --git a/runtime/lookup.c b/runtime/lookup.c
+index 096bf09..5aa00b9 100644
+--- a/runtime/lookup.c
++++ b/runtime/lookup.c
+@@ -203,6 +203,7 @@ lookupReload(lookup_t *pThis)
+ }
+ free(pThis->d.strtab);
+ pThis->d.strtab = newlu.d.strtab; /* hand table AND ALL STRINGS over! */
++ pThis->nmemb = newlu.nmemb;
+ pthread_rwlock_unlock(&pThis->rwlock);
+ errmsg.LogError(0, RS_RET_OK, "lookup table '%s' reloaded from file '%s'",
+ pThis->name, pThis->filename);
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index d77728a..49cb641 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -130,6 +130,7 @@ TESTS += \
+ incltest_dir_wildcard.sh \
+ incltest_dir_empty_wildcard.sh \
+ linkedlistqueue.sh \
++ lookup_table.sh \
+ key_dereference_on_uninitialized_variable_space.sh
+
+
+@@ -860,6 +861,10 @@ EXTRA_DIST= \
+ testsuites/rscript_re_extract.conf \
+ rscript_re_match.sh \
+ testsuites/rscript_re_match.conf \
++ lookup_table.sh \
++ testsuites/lookup_table.conf \
++ testsuites/xlate.lkp_tbl \
++ testsuites/xlate_more.lkp_tbl \
+ cfg.sh
+
+ # TODO: re-enable
+diff --git a/tests/diag.sh b/tests/diag.sh
+index 95d6adb..c489fff 100755
+--- a/tests/diag.sh
++++ b/tests/diag.sh
+@@ -195,6 +195,10 @@ case $1 in
+ echo WaitMainQueueEmpty | ./diagtalker || . $srcdir/diag.sh error-exit $?
+ fi
+ ;;
++ 'issue-HUP') # shut rsyslogd down when main queue is empty. $2 is the instance.
++ kill -HUP `cat rsyslog$2.pid`
++ ./msleep 1000
++ ;;
+ 'shutdown-when-empty') # shut rsyslogd down when main queue is empty. $2 is the instance.
+ if [ "$2" == "2" ]
+ then
+diff --git a/tests/lookup_table.sh b/tests/lookup_table.sh
+new file mode 100755
+index 0000000..fae2fab
+--- /dev/null
++++ b/tests/lookup_table.sh
+@@ -0,0 +1,24 @@
++#!/bin/bash
++# added 2015-09-30 by singh.janmejay
++# This file is part of the rsyslog project, released under ASL 2.0
++echo ===============================================================================
++echo \[lookup_table_reload.sh\]: test for lookup-table and HUP based reloading of it
++. $srcdir/diag.sh init
++cp $srcdir/testsuites/xlate.lkp_tbl $srcdir/xlate.lkp_tbl
++. $srcdir/diag.sh startup lookup_table.conf
++. $srcdir/diag.sh injectmsg 0 3
++. $srcdir/diag.sh wait-queueempty
++. $srcdir/diag.sh content-check "msgnum:00000000: foo_old"
++. $srcdir/diag.sh content-check "msgnum:00000001: bar_old"
++. $srcdir/diag.sh assert-content-missing "baz"
++cp $srcdir/testsuites/xlate_more.lkp_tbl $srcdir/xlate.lkp_tbl
++. $srcdir/diag.sh issue-HUP
++. $srcdir/diag.sh injectmsg 0 3
++echo doing shutdown
++. $srcdir/diag.sh shutdown-when-empty
++echo wait on shutdown
++. $srcdir/diag.sh wait-shutdown
++. $srcdir/diag.sh content-check "msgnum:00000000: foo_new"
++. $srcdir/diag.sh content-check "msgnum:00000001: bar_new"
++. $srcdir/diag.sh content-check "msgnum:00000002: baz"
++. $srcdir/diag.sh exit
+diff --git a/tests/testsuites/lookup_table.conf b/tests/testsuites/lookup_table.conf
+new file mode 100644
+index 0000000..29bd805
+--- /dev/null
++++ b/tests/testsuites/lookup_table.conf
+@@ -0,0 +1,9 @@
++$IncludeConfig diag-common.conf
++
++lookup_table(name="xlate" file="xlate.lkp_tbl")
++
++template(name="outfmt" type="string" string="- %msg% %$.lkp%\n")
++
++set $.lkp = lookup("xlate", $msg);
++
++action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+diff --git a/tests/testsuites/xlate.lkp_tbl b/tests/testsuites/xlate.lkp_tbl
+new file mode 100644
+index 0000000..30e2796
+--- /dev/null
++++ b/tests/testsuites/xlate.lkp_tbl
+@@ -0,0 +1,5 @@
++{
++ "table":[
++ {"index":" msgnum:00000000:", "value":"foo_old" },
++ {"index":" msgnum:00000001:", "value":"bar_old" }]
++}
+diff --git a/tests/testsuites/xlate_more.lkp_tbl b/tests/testsuites/xlate_more.lkp_tbl
+new file mode 100644
+index 0000000..2d3f452
+--- /dev/null
++++ b/tests/testsuites/xlate_more.lkp_tbl
+@@ -0,0 +1,6 @@
++{
++ "table":[
++ {"index":" msgnum:00000000:", "value":"foo_new" },
++ {"index":" msgnum:00000001:", "value":"bar_new" },
++ {"index":" msgnum:00000002:", "value":"baz" }]
++}