Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/bug-8861-eve-threaded-flow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# bug-8861-eve-threaded-flow

## Purpose

Regression test for Redmine #8861: a double-free during teardown of threaded
EVE output.

During init phase (LogFileNewThreadedCtx), threads shared prefix/sensor names
through a shallow copy.
In the deinit, all threads attempted to free the variables.
Suricata would then crash as a result of double free.
Comment on lines +8 to +11

## PCAP

The traffic is irrelevant to the bug, the pcap only needs to produce EVE alert
and flow records.
14 changes: 14 additions & 0 deletions tests/bug-8861-eve-threaded-flow/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
---
sensor-name: bug8861sensor

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
threaded: true
prefix: "@cee: "
types:
- alert
- flow
1 change: 1 addition & 0 deletions tests/bug-8861-eve-threaded-flow/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert ip any any -> any any (msg:"bug-8861 threaded eve flow"; sid:1; rev:1;)
39 changes: 39 additions & 0 deletions tests/bug-8861-eve-threaded-flow/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
requires:
min-version: 9

pcap: ../bug-5758/input.pcap

# Strip the configured prefix so the remaining payload can be validated as
# real JSON by the filter checks below.
pre-check: |
cat eve.*.json | sed 's/^@cee: //' > merged.json

checks:
- shell:
args: test ! -e eve.json
# Flow logging gives the receive thread and the flow recycler their
# own contexts on top of the workers, so at least three files exist even on
# a single-core host. The exact count tracks the CPU count.
- shell:
args: test $(ls eve.*.json | wc -l) -ge 3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fails on my OpenBSD runner:

===> bug-8861-eve-threaded-flow: Sub test #2: FAIL : Shell command failed: {'args': 'test $(ls eve.*.json | wc -l) -ge 3'} -> b''


- shell:
args: "cat eve.*.json | grep -v '^@cee: {' | wc -l | xargs"
expect: 0
- shell:
args: "cat eve.*.json | grep -v '\"host\":\"bug8861sensor\"' | wc -l | xargs"
expect: 0

- filter:
filename: merged.json
count: 2
match:
event_type: alert
host: bug8861sensor

- filter:
filename: merged.json
count: 1
match:
event_type: flow
host: bug8861sensor
Loading