From dd8cefdeea570343db77720e30d147521e7f23dd Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Wed, 24 Mar 2021 08:33:24 +0200 Subject: [PATCH] Fix crash report killed by message (#8683) We sometimes see the crash report saying we were killed by a random process even in cases where the crash was spontanius in redis. for instance, crashes found by the corrupt-dump test. It looks like this si_pid is sometimes left uninitialized, and a good way to tell if the crash originated in redis or trigged by outside is to look at si_code, real signal codes are always > 0, and ones generated by kill are have si_code of 0 or below. --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 2e9d4d1e4..37d38f048 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1809,7 +1809,7 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) { serverLog(LL_WARNING, "Accessing address: %p", (void*)info->si_addr); } - if (info->si_pid != -1) { + if (info->si_code <= SI_USER && info->si_pid != -1) { serverLog(LL_WARNING, "Killed by PID: %ld, UID: %d", (long) info->si_pid, info->si_uid); }