Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log/diag: Support diagnostic stacktraces on SIGSEGV #6200

Closed
wants to merge 6 commits into from

Conversation

jlucovsky
Copy link
Contributor

This PR supports configuring Suricata to emit a one-line diagnostic message containing a stacktrace when SIGSEGV occurs.

Requires

  • --enable-libunwind to configure support
  • libunwind must be available for configuration
  • Enablement in Suricata's configuration file (logging.sigsegv-stacktrace)
    Link to redmine ticket: 4526

Describe changes:

  • Documentation update for config setting
  • Error code for diagnostic message
  • Autoconf support for libunwind
  • Signal handler for SIGSEGV iff configured

#suricata-verify-pr:
#suricata-verify-repo:
#suricata-verify-branch:
#suricata-update-pr:
#suricata-update-repo:
#suricata-update-branch:
#libhtp-pr:
#libhtp-repo:
#libhtp-branch:

This commit adds support for enabling libunwind -- a library that can be
used to display stack information.

Use --enable-libunwind to check for availability. A diagnostic message
is displayed if libunwind cannot be found as requested.
This commit adds an error code for the diagnostic code used for SIGSEGV
diagnostic messages.
This commit adds a configuration setting to enable a stack trace message
if Suricata receives a SIGSEGV.
This commit adds a signal handler for SIGSEGV when configured. The
signal handler emits a one line stack trace using SCLogError. The intent
is to provide diagnostic information in deployments where core files are
not possible.

The diagnostic message is from the offending thread and includes the
stack trace; each frame includes the symbol + offset.
@jlucovsky jlucovsky requested review from norg and a team as code owners June 17, 2021 13:29
@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #6200 (49ad5cd) into master (fdab22d) will increase coverage by 0.00%.
The diff coverage is 50.00%.

@@           Coverage Diff           @@
##           master    #6200   +/-   ##
=======================================
  Coverage   76.92%   76.92%           
=======================================
  Files         611      611           
  Lines      186204   186233   +29     
=======================================
+ Hits       143236   143268   +32     
+ Misses      42968    42965    -3     
Flag Coverage Δ
fuzzcorpus 52.91% <0.00%> (+0.04%) ⬆️
suricata-verify 51.02% <50.00%> (-0.13%) ⬇️
unittests 63.08% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@jlucovsky
Copy link
Contributor Author

Continued in #6201

@jlucovsky jlucovsky closed this Jun 17, 2021
@jlucovsky jlucovsky deleted the 4526/1 branch January 30, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant