File 0001-bugfix-imfile-segfault-in-ratelimiter.patch of Package rsyslog.17135
From b54769b4d8371ce1d60e3c43172a445336ec79b6 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <rgerhards@adiscon.com>
Date: Mon, 24 Sep 2018 13:27:26 +0200
Subject: [PATCH] bugfix imfile: segfault in ratelimiter
imfile crashes inside rate limit processing, often when log
files are rotated. However, this could occur in any case where
the monitored files was closed by imfile, it rotation is just
the most probable cause for this (moving the file to another
directory or deleting it also can trigger the same issue, for
example). The root cause was invalid sequence of operations.
closes https://github.com/rsyslog/rsyslog/issues/3021
---
plugins/imfile/imfile.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: rsyslog-8.33.1/plugins/imfile/imfile.c
===================================================================
--- rsyslog-8.33.1.orig/plugins/imfile/imfile.c
+++ rsyslog-8.33.1/plugins/imfile/imfile.c
@@ -749,9 +749,6 @@ act_obj_destroy(act_obj_t *const act, co
DBGPRINTF("act_obj_destroy: act %p '%s', wd %d, pStrm %p, is_deleted %d, in_move %d\n",
act, act->name, act->wd, act->pStrm, is_deleted, act->in_move);
- if(act->ratelimiter != NULL) {
- ratelimitDestruct(act->ratelimiter);
- }
if(act->pStrm != NULL) {
const instanceConf_t *const inst = act->edge->instarr[0];// TODO: same file, multiple instances?
pollFile(act); /* get any left-over data */
@@ -768,6 +765,9 @@ act_obj_destroy(act_obj_t *const act, co
unlink((char*)statefn);
}
}
+ if(act->ratelimiter != NULL) {
+ ratelimitDestruct(act->ratelimiter);
+ }
#ifdef HAVE_INOTIFY_INIT
if(act->wd != -1) {
wdmapDel(act->wd);
@@ -1273,7 +1273,7 @@ pollFileReal(act_obj_t *act, cstr_t **pC
DEFiRet;
int nProcessed = 0;
- DBGPRINTF("pollFileReal enter, pStrm %p, name '%s'\n", act->pStrm, act->name);
+ DBGPRINTF("pollFileReal enter, act %p, pStrm %p, name '%s'\n", act, act->pStrm, act->name);
DBGPRINTF("pollFileReal enter, edge %p\n", act->edge);
DBGPRINTF("pollFileReal enter, edge->instarr %p\n", act->edge->instarr);