Project

General

Profile

Actions

Bug #4086

closed

dns: memory leak in v1 dns eve logging

Added by Victor Julien almost 2 years ago. Updated almost 2 years ago.

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

Description

Initial title: memory leak in dns-eve SV test

If you run dns-eve with the following change to SV's run.py:

diff --git a/run.py b/run.py
index bf047c1..bd6eb68 100755
--- a/run.py
+++ b/run.py
@@ -566,7 +566,7 @@ class TestRunner:
             "TZ": "UTC",
             "TEST_DIR": self.directory,
             "OUTPUT_DIR": self.output,
-            "ASAN_OPTIONS": "detect_leaks=0",
+            "ASAN_OPTIONS": "detect_leaks=1",
         }
         env = os.environ.copy()
         env.update(extraenv)

Suricata (with ASAN enabled) will give:

=================================================================
==584967==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 280 byte(s) in 5 object(s) allocated from:
    #0 0x71fd7d in malloc (/home/victor/sync/devel/eidps/src/suricata+0x71fd7d)
    #1 0x1d4225b in alloc::alloc::alloc::h6d890dc542319208 /usr/src/rustc-1.43.0/src/liballoc/alloc.rs:81:4
    #2 0x164107c in OutputTxLog /home/victor/devel/eidps/src/output-tx.c:298:17
    #3 0x15b775d in OutputLoggerLog /home/victor/devel/eidps/src/output.c:882:9
    #4 0x155ac5b in FlowWorker /home/victor/devel/eidps/src/flow-worker.c:545:5
    #5 0x18c5e91 in TmThreadsSlotVarRun /home/victor/devel/eidps/src/tm-threads.c:117:21
    #6 0x18d2a3c in TmThreadsSlotVar /home/victor/devel/eidps/src/tm-threads.c:452:17
    #7 0x7fa5d0cd8608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477:8

Indirect leak of 20480 byte(s) in 5 object(s) allocated from:
    #0 0x71fd7d in malloc (/home/victor/sync/devel/eidps/src/suricata+0x71fd7d)
    #1 0x20f15db in alloc::alloc::alloc::h728c22fee7f511fa /usr/src/rustc-1.43.0/src/liballoc/alloc.rs:81:4
    #2 0x164107c in OutputTxLog /home/victor/devel/eidps/src/output-tx.c:298:17
    #3 0x15b775d in OutputLoggerLog /home/victor/devel/eidps/src/output.c:882:9
    #4 0x155ac5b in FlowWorker /home/victor/devel/eidps/src/flow-worker.c:545:5
    #5 0x18c5e91 in TmThreadsSlotVarRun /home/victor/devel/eidps/src/tm-threads.c:117:21
    #6 0x18d2a3c in TmThreadsSlotVar /home/victor/devel/eidps/src/tm-threads.c:452:17
    #7 0x7fa5d0cd8608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477:8

Indirect leak of 40 byte(s) in 5 object(s) allocated from:
    #0 0x71fd7d in malloc (/home/victor/sync/devel/eidps/src/suricata+0x71fd7d)
    #1 0x1d4225b in alloc::alloc::alloc::h6d890dc542319208 /usr/src/rustc-1.43.0/src/liballoc/alloc.rs:81:4
    #2 0x164107c in OutputTxLog /home/victor/devel/eidps/src/output-tx.c:298:17
    #3 0x15b775d in OutputLoggerLog /home/victor/devel/eidps/src/output.c:882:9
    #4 0x155ac5b in FlowWorker /home/victor/devel/eidps/src/flow-worker.c:545:5
    #5 0x18c5e91 in TmThreadsSlotVarRun /home/victor/devel/eidps/src/tm-threads.c:117:21
    #6 0x18d2a3c in TmThreadsSlotVar /home/victor/devel/eidps/src/tm-threads.c:452:17
    #7 0x7fa5d0cd8608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477:8

SUMMARY: AddressSanitizer: 20800 byte(s) leaked in 15 allocation(s).

Actions #1

Updated by Victor Julien almost 2 years ago

Please also check if 5.0 has the same issue.

Actions #2

Updated by Victor Julien almost 2 years ago

  • Priority changed from Normal to High
Actions #3

Updated by Jason Ish almost 2 years ago

Victor Julien wrote in #note-1:

Please also check if 5.0 has the same issue.

Issue with JsonBuilder migration, so only affects 6.0.

Actions #4

Updated by Jason Ish almost 2 years ago

  • Subject changed from memory leak in dns-eve SV test to dns: memory leak in v1 dns eve logging
  • Description updated (diff)
  • Affected Versions 6.0.0 added

Victor Julien wrote in #note-1:

Please also check if 5.0 has the same issue.

Issue with JsonBuilder migration, so only affects 6.0.

Actions #5

Updated by Jason Ish almost 2 years ago

  • Status changed from Assigned to Closed

Fixed. PR: https://github.com/OISF/suricata/pull/5563.

No backports required.

Actions

Also available in: Atom PDF