[PATCH xserver v2] os: Handle SIGABRT

Michel Dänzer michel at daenzer.net
Wed Apr 26 09:31:08 UTC 2017


From: Michel Dänzer <michel.daenzer at amd.com>

Without this, assertion failures can make life hard for users and those
trying to help them.

v2:
* Change commit log wording slightly to "can make life hard", since
  apparently e.g. logind can alleviate that somewhat.
* Set default handler for SIGABRT in
  hw/xfree86/common/xf86Init.c:InstallSignalHandlers() and
  hw/xquartz/quartz.c:QuartzInitOutput() (Eric Anholt)

Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---

Thanks for the review and suggestions, Eric!

 hw/xfree86/common/xf86Init.c | 1 +
 hw/xquartz/quartz.c          | 1 +
 os/osinit.c                  | 1 +
 os/utils.c                   | 6 ++++++
 4 files changed, 9 insertions(+)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index d3c7c47b0..d0bd6e95b 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -309,6 +309,7 @@ InstallSignalHandlers(void)
     }
     else {
         OsSignal(SIGSEGV, SIG_DFL);
+        OsSignal(SIGABRT, SIG_DFL);
         OsSignal(SIGILL, SIG_DFL);
 #ifdef SIGEMT
         OsSignal(SIGEMT, SIG_DFL);
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index c8b6f966d..c8ea3bf8b 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -178,6 +178,7 @@ QuartzInitOutput(int argc,
 {
     /* For XQuartz, we want to just use the default signal handler to work better with CrashTracer */
     signal(SIGSEGV, SIG_DFL);
+    signal(SIGABRT, SIG_DFL);
     signal(SIGILL, SIG_DFL);
 #ifdef SIGEMT
     signal(SIGEMT, SIG_DFL);
diff --git a/os/osinit.c b/os/osinit.c
index 5b2f6b546..cd769d181 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -173,6 +173,7 @@ OsInit(void)
         int i;
 
         int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
+            SIGABRT,
             SIGSYS,
             SIGXCPU,
             SIGXFSZ,
diff --git a/os/utils.c b/os/utils.c
index 3f8bac5c6..226b9c817 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1353,6 +1353,12 @@ OsAbort(void)
 #ifndef __APPLE__
     OsBlockSignals();
 #endif
+#if !defined(WIN32) || defined(__CYGWIN__)
+    /* abort() raises SIGABRT, so we have to stop handling that to prevent
+     * recursion
+     */
+    OsSignal(SIGABRT, SIG_DFL);
+#endif
     abort();
 }
 
-- 
2.11.0



More information about the xorg-devel mailing list