#
0efcd352 |
| 14-Apr-2022 |
Stephen Hemminger <stephen@networkplumber.org> |
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 whi
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>
show more ...
|