Project

General

Profile

Actions

Bug #4216

closed

5.0.5 in socket mode crashes when using file-store due to uninitialized stats_ctx

Added by Matt Bing over 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:
Needs backport to 5.0, Needs backport to 6.0

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 2 (0 open2 closed)

Copied to Suricata - Bug #4301: 5.0.5 in socket mode crashes when using file-store due to uninitialized stats_ctxClosedJeff LucovskyActions
Copied to Suricata - Bug #4302: 6.0.x in socket mode crashes when using file-store due to uninitialized stats_ctxClosedJason IshActions
Actions #1

Updated by Jason Ish over 3 years ago

  • Status changed from New to Assigned
  • Assignee set to Jason Ish
  • Affected Versions 6.0.1 added
  • Label Needs backport to 5.0, Needs backport to 6.0 added

Confirmed. 6.0 affected as well. I have a fix, will do a pull request soon.

Actions #2

Updated by Jason Ish about 3 years ago

  • Status changed from Assigned to In Review
Actions #3

Updated by Victor Julien about 3 years ago

  • Target version set to 7.0.0-beta1
Actions #4

Updated by Jeff Lucovsky about 3 years ago

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

Updated by Jeff Lucovsky about 3 years ago

  • Copied to Bug #4302: 6.0.x in socket mode crashes when using file-store due to uninitialized stats_ctx added
Actions #6

Updated by Jason Ish over 2 years ago

  • Status changed from In Review to Closed

Merged into master a while back: 0aed5e188b214d56107e66ea8e38dfb7d5a13758

Actions

Also available in: Atom PDF