From: Masud Hasan (mashasan) Date: Thu, 18 Jun 2020 18:51:45 +0000 (+0000) Subject: Merge pull request #2272 in SNORT/snort3 from ~MMATIRKO/snort3:reg_xtra_fix to master X-Git-Tag: 3.0.2-1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7410d813c60ab7e793ce181c90879a3be3cc7af7;p=thirdparty%2Fsnort3.git Merge pull request #2272 in SNORT/snort3 from ~MMATIRKO/snort3:reg_xtra_fix to master Squashed commit of the following: commit e914576493bee03e7170506519b0f8662f760b90 Author: Michael Matirko Date: Wed Jun 17 12:02:31 2020 -0400 stream: lock xtradata stream_impl to avoid data race on logging --- diff --git a/src/stream/stream.cc b/src/stream/stream.cc index f9e2284de..06bace610 100644 --- a/src/stream/stream.cc +++ b/src/stream/stream.cc @@ -24,6 +24,7 @@ #include "stream.h" #include +#include #include "detection/detection_engine.h" #include "flow/flow_control.h" @@ -60,6 +61,7 @@ public: }; static StreamImpl stream; +static std::mutex stream_xtra_mutex; //------------------------------------------------------------------------- // session foo @@ -542,6 +544,7 @@ uint32_t Stream::get_xtra_data_map(LogFunction*& f) void Stream::reg_xtra_data_log(LogExtraData f, void* config) { + const std::lock_guard xtra_lock(stream_xtra_mutex); stream.extra_data_log = f; stream.extra_data_config = config; }