Project

General

Profile

Actions

Bug #4302

closed

6.0.x in socket mode crashes when using file-store due to uninitialized stats_ctx

Added by Jeff Lucovsky over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

When using 5.0.5 in socket mode with a config that enables file-store:

# suricata -c /suricata.yaml -v --unix-socket=/tmp/suricata.socket
11/12/2020 -- 18:19:56 - <Notice> - This is Suricata version 5.0.5 RELEASE running in SYSTEM mode
11/12/2020 -- 18:19:56 - <Info> - CPUs/cores online: 8
suricata: counters.c:1007: StatsRegisterGlobalCounter: Assertion `!(stats_ctx == ((void *)0))' failed.
Aborted (core dumped)

This diff properly initializes stats_ctx and seems to fix the issue:

diff --git a/src/suricata.c b/src/suricata.c
index 5b76b0559..dbcc123fe 100644
--- a/src/suricata.c
+++ b/src/suricata.c
@@ -2300,10 +2300,10 @@ static int InitSignalHandler(SCInstance *suri)
  * Will be run once per pcap in unix-socket mode */
 void PreRunInit(const int runmode)
 {
+    StatsInit();
     if (runmode == RUNMODE_UNIX_SOCKET)
         return;

-    StatsInit();
 #ifdef PROFILING
     SCProfilingRulesGlobalInit();
     SCProfilingKeywordsGlobalInit();

Related issues 1 (0 open1 closed)

Copied from Suricata - Bug #4216: 5.0.5 in socket mode crashes when using file-store due to uninitialized stats_ctxClosedJason IshActions
Actions #1

Updated by Jeff Lucovsky over 3 years ago

  • Copied from Bug #4216: 5.0.5 in socket mode crashes when using file-store due to uninitialized stats_ctx added
Actions #2

Updated by Victor Julien over 3 years ago

  • Status changed from Assigned to Closed
  • Assignee changed from Shivani Bhardwaj to Jason Ish
Actions #3

Updated by Jason Ish over 3 years ago

  • Subject changed from 5.0.5 in socket mode crashes when using file-store due to uninitialized stats_ctx to 6.0.x in socket mode crashes when using file-store due to uninitialized stats_ctx
Actions

Also available in: Atom PDF