Commit 2d22dfe3 authored by Matt Joras's avatar Matt Joras Committed by Facebook Github Bot

Print si_code even if there's no string decoding available.

Summary: We are getting SIGILLs that end up not printing a code because it's not in the cases in `signal_reason`, which isn't particularly helpful. Additionally, the check for kernel-sourced si_codes is incorrect. Any code > 0 is from the kernel. This causes folly to log nonsense PIDs and UIDs.

Differential Revision: D14388102

fbshipit-source-id: 3201a16bbe9eb9038ebc5601044406f5333ec9e9
parent 01323e31
......@@ -365,7 +365,7 @@ void dumpSignalInfo(int signum, siginfo_t* siginfo) {
printDec(syscall(__NR_gettid));
// Kernel-sourced signals don't give us useful info for pid/uid.
if (siginfo->si_code != SI_KERNEL) {
if (siginfo->si_code <= 0) {
print(") (maybe from PID ");
printDec(siginfo->si_pid);
print(", UID ");
......@@ -374,9 +374,17 @@ void dumpSignalInfo(int signum, siginfo_t* siginfo) {
auto reason = signal_reason(signum, siginfo->si_code);
print(") (code: ");
// If we can't find a reason code make a best effort to print the (int) code.
if (reason != nullptr) {
print(") (code: ");
print(reason);
} else {
if (siginfo->si_code < 0) {
print("-");
printDec(-siginfo->si_code);
} else {
printDec(siginfo->si_code);
}
}
print("), stack trace: ***\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment