From 1589cfb04d44c20ed745996dcce5a5badf40f3df Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 14 Aug 2024 00:07:02 +0100 Subject: [PATCH] Tidy log for panic-die --- src/src/exim.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/src/exim.c b/src/src/exim.c index 97a22f9d9..d86625f92 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -274,17 +274,22 @@ static void #ifdef SA_SIGINFO segv_handler(int sig, siginfo_t * info, void * uctx) { -log_write(0, LOG_MAIN|LOG_PANIC, "SIGSEGV (fault address: %p)", info->si_addr); -# if defined(SEGV_MAPERR) && defined(SEGV_ACCERR) && defined(SEGV_BNDERR) && defined(SEGV_PKUERR) -switch (info->si_code) +if (!panic_coredump) { - case SEGV_MAPERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_MAPERR"); break; - case SEGV_ACCERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_ACCERR"); break; - case SEGV_BNDERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_BNDERR"); break; - case SEGV_PKUERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_PKUERR"); break; + log_write(0, LOG_MAIN|LOG_PANIC, "SIGSEGV (fault address: %p)", info->si_addr); + # if defined(SEGV_MAPERR) && defined(SEGV_ACCERR) && defined(SEGV_BNDERR) && defined(SEGV_PKUERR) + switch (info->si_code) + { + case SEGV_MAPERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_MAPERR"); break; + case SEGV_ACCERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_ACCERR"); break; + case SEGV_BNDERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_BNDERR"); break; + case SEGV_PKUERR: log_write(0, LOG_MAIN|LOG_PANIC, "SEGV_PKUERR"); break; + } + # endif } -# endif -if (US info->si_addr < US 4096) +if (panic_coredump) + log_write(0, LOG_MAIN|LOG_PANIC, "SIGSEGV (deliberate trap)"); +else if (US info->si_addr < US 4096) log_write(0, LOG_MAIN|LOG_PANIC, "SIGSEGV (null pointer indirection)"); else log_write(0, LOG_MAIN|LOG_PANIC, "SIGSEGV (maybe attempt to write to immutable memory)"); -- 2.30.2