]> git.droids-corp.org - dpdk.git/commit
eal/unix: make stack dump signal safe
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 14 Apr 2022 20:19:40 +0000 (13:19 -0700)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 23 Jun 2022 11:40:50 +0000 (13:40 +0200)
commit0efcd352e257ae88a16667b8b6d5dcf0319a4192
tree3f7f210d92efc0a7beb23f4d30f870177d6b43bb
parent2fbada91545c004f04449500af0c6276900317ab
eal/unix: make stack dump signal safe

rte_dump_stack() needs to be usable in situations when a bug is
encountered and from signal handlers (such as SEGV).

Glibc backtrace_symbols() calls malloc which makes it
dangerous in a signal handler that is handling errors that maybe
due to memory corruption. Additionally, rte_log() is unsafe because
syslog() is not signal safe; printf() is also documented as
not being safe.

This version formats message and uses writev for each line in a manner
similar to what glibc version of backtrace_symbols_fd() does. The
FreeBSD version of backtrace_symbols_fd() is not signal safe.

Sample output:

0: ./build/app/dpdk-testpmd (rte_dump_stack+0x2b) [560a6e9c002b]
1: ./build/app/dpdk-testpmd (main+0xad) [560a6decd5ad]
2: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xcd) [7fd43d3e27fd]
3: ./build/app/dpdk-testpmd (_start+0x2a) [560a6e83628a]

Bugzilla ID: 929

Acked-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: David Marchand <david.marchand@redhat.com>
lib/eal/freebsd/eal_debug.c [deleted file]
lib/eal/freebsd/meson.build
lib/eal/include/rte_debug.h
lib/eal/linux/eal_debug.c [deleted file]
lib/eal/linux/meson.build
lib/eal/unix/eal_debug.c [new file with mode: 0644]
lib/eal/unix/meson.build