coredump: add COREDUMP_CODE field for signal reason
Introduce COREDUMP_CODE as a new captured field alongside the existing COREDUMP_SIGNAL. While COREDUMP_SIGNAL identifies the signal number that terminated the process, COREDUMP_CODE provides the reason the signal was sent. For example, a process terminated by SIGSEGV due to invalid permissions would produce COREDUMP_SIGNAL=11 and COREDUMP_CODE=2 (SEGV_ACCERR). The kernel exposes coredump_code via pidfd starting with v7.1: https://git.kernel.org/torvalds/c/701f7f4fbabbf4989ba6fbf033b160dd943221d5 System administrators can find both the signal and code in coredumpctl info: $ coredumpctl info | grep Signal: Signal: 11 (SEGV) si_code: SEGV_MAPERR Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
This commit is contained in:
@@ -166,6 +166,12 @@ coredumpctl info "$CORE_TEST_BIN" | grep "TID:" >/dev/null
|
||||
# Check the field is queryable in the journal
|
||||
coredumpctl -F COREDUMP_TID
|
||||
|
||||
# If COREDUMP_CODE= is present, check that the expected code is SI_USER (0).
|
||||
if coredumpctl -F COREDUMP_CODE | grep "^0$" >/dev/null; then
|
||||
coredumpctl info "$CORE_TEST_BIN" | grep --fixed-strings "Signal: 5 (TRAP) si_code: SI_USER" >/dev/null
|
||||
coredumpctl info --json=short "$CORE_TEST_BIN" | jq -se 'any(.[]; .SignalCode == 0)'
|
||||
fi
|
||||
|
||||
coredumpctl debug --debugger=/bin/true "$CORE_TEST_BIN"
|
||||
SYSTEMD_DEBUGGER=/bin/true coredumpctl debug "$CORE_TEST_BIN"
|
||||
coredumpctl debug --debugger=/bin/true --debugger-arguments="-this --does --not 'do anything' -a -t --all" "${CORE_TEST_BIN##*/}"
|
||||
|
||||
Reference in New Issue
Block a user