Project

General

Profile

Actions

Bug #2604

closed

memleak: DetectEngineStateAlloc with ipsec-events.rules

Added by Peter Manev about 6 years ago. Updated about 6 years ago.

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

Description

Some memleaks are observed when running against pcaps that are comprised of - kerberos/nfs/ike traffic.
Using the source suricata rules ( https://github.com/OISF/suricata/blob/master/rules/ipsec-events.rules ).
Observation - running the same routine/test against traffic that is exclusively smb/http/dns/tls/ssh/smtp does not generate those memleaks.
Pcap privately shared.

Using -

pevma@DonPedro:~/thetrenches/Suricata/QA/tmp$ /opt/suricata-asan/bin/suricata --build-info
This is Suricata version 4.1.0-dev (rev 1f4cd75f)
Features: UNITTESTS PCAP_SET_BUFF AF_PACKET HAVE_PACKET_FANOUT LIBCAP_NG LIBNET1.1 HAVE_HTP_URI_NORMALIZE_HOOK PCRE_JIT HAVE_NSS HAVE_LUA HAVE_LUAJIT HAVE_LIBJANSSON TLS MAGIC RUST 
SIMD support: SSE_4_2 SSE_4_1 SSE_3 
Atomic intrisics: 1 2 4 8 16 byte(s)
64-bits, Little-endian architecture
GCC version 4.2.1 Compatible Clang 6.0.1 (tags/RELEASE_601/final), C version 199901
compiled with _FORTIFY_SOURCE=0
L1 cache line size (CLS)=64
thread local storage method: __thread
compiled with LibHTP v0.5.27, linked against LibHTP v0.5.27

Suricata Configuration:
  AF_PACKET support:                       yes
  eBPF support:                            no
  XDP support:                             
  PF_RING support:                         no
  NFQueue support:                         no
  NFLOG support:                           no
  IPFW support:                            no
  Netmap support:                          no
  DAG enabled:                             no
  Napatech enabled:                        no
  WinDivert enabled:                       no

  Unix socket enabled:                     yes
  Detection enabled:                       yes

  Libmagic support:                        yes
  libnss support:                          yes
  libnspr support:                         yes
  libjansson support:                      yes
  liblzma support:                         no
  hiredis support:                         no
  hiredis async with libevent:             no
  Prelude support:                         no
  PCRE jit:                                yes
  LUA support:                             yes, through luajit
  libluajit:                               yes
  libgeoip:                                yes
  Non-bundled htp:                         no
  Old barnyard2 support:                   no
  Hyperscan support:                       yes
  Libnet support:                          yes
  liblz4 support:                          no

  Rust support (experimental):             yes
  Rust strict mode:                        no
  Rust debug mode:                         no

  Suricatasc install:                      yes

  Profiling enabled:                       no
  Profiling locks enabled:                 no

Development settings:
  Coccinelle / spatch:                     yes
  Unit tests enabled:                      yes
  Debug output enabled:                    no
  Debug validation enabled:                no

Generic build parameters:
  Installation prefix:                     /opt/suricata-asan
  Configuration directory:                 /opt/suricata-asan/etc/suricata/
  Log directory:                           /opt/suricata-asan/var/log/suricata/

  --prefix                                 /opt/suricata-asan
  --sysconfdir                             /opt/suricata-asan/etc
  --localstatedir                          /opt/suricata-asan/var

  Host:                                    x86_64-pc-linux-gnu
  Compiler:                                clang (exec name) / clang (real)
  GCC Protect enabled:                     no
  GCC march native enabled:                yes
  GCC Profile enabled:                     no
  Position Independent Executable enabled: no
  CFLAGS                                   -ggdb3 -Werror -Wchar-subscripts -fno-strict-aliasing -fstack-protector-all -fsanitize=address -fno-omit-frame-pointer -Wno-unused-parameter -Wno-unused-function -march=native -I${srcdir}/../rust/gen/c-headers
  PCAP_CFLAGS                               -I/usr/include
  SECCFLAGS                                

pevma@DonPedro:~/thetrenches/Suricata/QA/tmp$ sudo rm locallog/* -r; sudo LSAN_OPTIONS=suppressions=/home/pevma/thetrenches/Suricata/suricomp/suricata/qa/lsan.suppress ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer   /opt/suricata-asan/bin/suricata  -S /home/pevma/Work/Suricata/suricomp/suricata/rules/ipsec-events.rules   -r /home/pevma/thetrenches/pcaps/all/qa-v2/qa-pcaps/kerberos.pcap -l locallog/

[13006] 22/8/2018 -- 21:19:54 - (suricata.c:1084) <Notice> (LogVersion) -- This is Suricata version 4.1.0-dev (rev 1f4cd75f)
[13006] 22/8/2018 -- 21:19:54 - (tm-threads.c:2172) <Notice> (TmThreadWaitOnThreadInit) -- all 9 packet processing threads, 4 management threads initialized, engine started.
[13006] 22/8/2018 -- 21:19:55 - (suricata.c:2839) <Notice> (SuricataMainLoop) -- Signal Received.  Stopping engine.
[13007] 22/8/2018 -- 21:19:55 - (source-pcap-file.c:383) <Notice> (ReceivePcapFileThreadExitStats) -- Pcap-file module read 1 files, 20000 packets, 2798691 bytes

=================================================================
==13006==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 2 object(s) allocated from:
    #0 0x4ea760 in __interceptor_malloc (/opt/suricata-asan/bin/suricata+0x4ea760)
    #1 0xf4159c in DetectEngineStateAlloc /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect-engine-state.c:169:28
    #2 0xf41e85 in DetectRunStoreStateTx /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect-engine-state.c:231:19
    #3 0xb1c7d9 in DetectRunTxInspectRule /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1311:13
    #4 0xb1568b in DetectRunTx /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1545:27
    #5 0xaaedc4 in DetectRun /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:141:9
    #6 0xaae413 in DetectFlow /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1662:11
    #7 0xaadf24 in Detect /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1736:9
    #8 0x1434b7e in FlowWorker /home/pevma/thetrenches/Suricata/suricomp/suricata/src/flow-worker.c:258:9
    #9 0x18009ce in TmThreadsSlotVarRun /home/pevma/thetrenches/Suricata/suricomp/suricata/src/tm-threads.c:143:17
    #10 0x18128be in TmThreadsSlotVar /home/pevma/thetrenches/Suricata/suricomp/suricata/src/tm-threads.c:598:17
    #11 0x7fcc98d20f29 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7f29)

Indirect leak of 384 byte(s) in 3 object(s) allocated from:
    #0 0x4ea760 in __interceptor_malloc (/opt/suricata-asan/bin/suricata+0x4ea760)
    #1 0xf5ad1c in DeStateStoreAlloc /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect-engine-state.c:90:23
    #2 0xf41ffd in DeStateSignatureAppend /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect-engine-state.c:138:17
    #3 0xf41ef7 in DetectRunStoreStateTx /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect-engine-state.c:240:5
    #4 0xb1c7d9 in DetectRunTxInspectRule /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1311:13
    #5 0xb1568b in DetectRunTx /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1545:27
    #6 0xaaedc4 in DetectRun /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:141:9
    #7 0xaae413 in DetectFlow /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1662:11
    #8 0xaadf24 in Detect /home/pevma/thetrenches/Suricata/suricomp/suricata/src/detect.c:1736:9
    #9 0x1434b7e in FlowWorker /home/pevma/thetrenches/Suricata/suricomp/suricata/src/flow-worker.c:258:9
    #10 0x18009ce in TmThreadsSlotVarRun /home/pevma/thetrenches/Suricata/suricomp/suricata/src/tm-threads.c:143:17
    #11 0x18128be in TmThreadsSlotVar /home/pevma/thetrenches/Suricata/suricomp/suricata/src/tm-threads.c:598:17
    #12 0x7fcc98d20f29 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7f29)

SUMMARY: AddressSanitizer: 480 byte(s) leaked in 5 allocation(s).
pevma@DonPedro:~/thetrenches/Suricata/QA/tmp$
Actions

Also available in: Atom PDF