[exim-cvs] paniclog sigsegv events

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Exim Git Commits Mailing List
Fecha:  
A: exim-cvs
Asunto: [exim-cvs] paniclog sigsegv events
Gitweb: https://git.exim.org/exim.git/commitdiff/1f1633046e3e3828c11f23a72b03fd03e20fd6e8
Commit:     1f1633046e3e3828c11f23a72b03fd03e20fd6e8
Parent:     1f7081b85e684302c091d8b35226ba3418c03f2b
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun May 16 15:37:18 2021 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Mon Jun 28 00:30:02 2021 +0100


    paniclog sigsegv events
---
 src/src/exim.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)


diff --git a/src/src/exim.c b/src/src/exim.c
index eb1d834..a42c48b 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