From 1f1633046e3e3828c11f23a72b03fd03e20fd6e8 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 16 May 2021 15:37:18 +0100 Subject: paniclog sigsegv events --- src/src/exim.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/src/exim.c b/src/src/exim.c index eb1d83416..a42c48b2c 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -211,6 +211,19 @@ exit(1); } +/*********************************************** +* Handler for SIGSEGV * +***********************************************/ + +static void +segv_handler(int sig) +{ +log_write(0, LOG_MAIN|LOG_PANIC, "SIGSEGV (maybe attempt to write to immutable memory)"); +signal(SIGSEGV, SIG_DFL); +kill(getpid(), sig); +} + + /************************************************* * Handler for SIGUSR1 * *************************************************/ @@ -1805,7 +1818,8 @@ descriptive text. */ process_info = store_get(PROCESS_INFO_SIZE, TRUE); /* tainted */ set_process_info("initializing"); -os_restarting_signal(SIGUSR1, usr1_handler); +os_restarting_signal(SIGUSR1, usr1_handler); /* exiwhat */ +signal(SIGSEGV, segv_handler); /* log faults */ /* If running in a dockerized environment, the TERM signal is only delegated to the PID 1 if we request it by setting an signal handler */ @@ -5464,15 +5478,15 @@ that SIG_IGN works. */ if (!f.synchronous_delivery) { - #ifdef SA_NOCLDWAIT +#ifdef SA_NOCLDWAIT struct sigaction act; act.sa_handler = SIG_IGN; sigemptyset(&(act.sa_mask)); act.sa_flags = SA_NOCLDWAIT; sigaction(SIGCHLD, &act, NULL); - #else +#else signal(SIGCHLD, SIG_IGN); - #endif +#endif } /* Save the current store pool point, for resetting at the start of -- cgit v1.2.3