Blame SOURCES/rsyslog-8.24.0-rhbz1778841-serialize-crash-race.patch
|
|
a74fa0 |
From: Jiri Vymazal <jvymazal@redhat.com>
|
|
|
a74fa0 |
Date: Wed, 18 Dec 2019 09:48:15 +0100
|
|
|
a74fa0 |
Subject: [PATCH] Fix race condition related to libfastjson when using DA queue
|
|
|
a74fa0 |
|
|
|
a74fa0 |
Rsyslogd aborts when writing to disk queue from multiple workers simultaneously.
|
|
|
a74fa0 |
It is assumed that libfastjson is not thread-safe.
|
|
|
a74fa0 |
Resolve libfastjson race condition when writing to disk queue.
|
|
|
a74fa0 |
|
|
|
a74fa0 |
see also https://github.com/rsyslog/rsyslog/issues/4099
|
|
|
a74fa0 |
---
|
|
|
a74fa0 |
runtime/msg.c | 4 ++++
|
|
|
a74fa0 |
1 file changed, 4 insertions(+)
|
|
|
a74fa0 |
|
|
|
a74fa0 |
diff --git a/runtime/msg.c b/runtime/msg.c
|
|
|
a74fa0 |
index b5c17cfdd4..f9da40005f 100644
|
|
|
a74fa0 |
--- a/runtime/msg.c
|
|
|
a74fa0 |
+++ b/runtime/msg.c
|
|
|
a74fa0 |
@@ -1211,11 +1211,15 @@ static rsRetVal MsgSerialize(smsg_t *pThis, strm_t *pStrm)
|
|
|
a74fa0 |
psz = pThis->pszStrucData;
|
|
|
a74fa0 |
CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszStrucData"), PROPTYPE_PSZ, (void*) psz));
|
|
|
a74fa0 |
if(pThis->json != NULL) {
|
|
|
a74fa0 |
+ MsgLock(pThis);
|
|
|
a74fa0 |
psz = (uchar*) json_object_get_string(pThis->json);
|
|
|
a74fa0 |
+ MsgUnlock(pThis);
|
|
|
a74fa0 |
CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("json"), PROPTYPE_PSZ, (void*) psz));
|
|
|
a74fa0 |
}
|
|
|
a74fa0 |
if(pThis->localvars != NULL) {
|
|
|
a74fa0 |
+ MsgLock(pThis);
|
|
|
a74fa0 |
psz = (uchar*) json_object_get_string(pThis->localvars);
|
|
|
a74fa0 |
+ MsgUnlock(pThis);
|
|
|
a74fa0 |
CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("localvars"), PROPTYPE_PSZ, (void*) psz));
|
|
|
a74fa0 |
}
|
|
|
a74fa0 |
|