Patchwork [3/5] linux-user: remove signal handler before calling abort()

login
register
mail settings
Submitter Riku Voipio
Date Jan. 26, 2010, 4 p.m.
Message ID <1264521604-2020-4-git-send-email-riku.voipio@iki.fi>
Download mbox | patch
Permalink /patch/43714/
State New
Headers show

Comments

Riku Voipio - Jan. 26, 2010, 4 p.m.
From: Riku Voipio <riku.voipio@nokia.com>

Qemu may hang in host_signal_handler after qemu has done a
seppuku with cpu_abort(). But at this stage we are not really
interested in target process coredump anymore, so unregister
host_signal_handler to die grafefully.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
---
 exec.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Patch

diff --git a/exec.c b/exec.c
index 71f655f..3145b83 100644
--- a/exec.c
+++ b/exec.c
@@ -40,6 +40,7 @@ 
 #include "kvm.h"
 #if defined(CONFIG_USER_ONLY)
 #include <qemu.h>
+#include <signal.h>
 #endif
 
 //#define DEBUG_TB_INVALIDATE
@@ -1692,6 +1693,14 @@  void cpu_abort(CPUState *env, const char *fmt, ...)
     }
     va_end(ap2);
     va_end(ap);
+#if defined(CONFIG_USER_ONLY)
+    {
+        struct sigaction act;
+        sigfillset(&act.sa_mask);
+        act.sa_handler = SIG_DFL;
+        sigaction(SIGABRT, &act, NULL);
+    }
+#endif
     abort();
 }