Blame SOURCES/rsyslog-8.1911.0-rhbz1789675-serialize-crash-race.patch

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