qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SI


From: Lionel Landwerlin
Subject: Re: [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation
Date: Sat, 03 Jan 2009 13:50:39 +0100

When a SIGSEGV signal is raised in user mode emulation the current
test to know whether the signal is sent by the kernel is wrong :

info->si_code == SI_KERNEL

according to /usr/include/bits/siginfo.h it should be

info->si_code > 0

/* Values for `si_code'.  Positive values are reserved for kernel-generated
   signals.  */

there is a lot of enums for that, all starting at positives values :

/* `si_code' values for SIGILL signal.  */
enum
{
  ILL_ILLOPC = 1,               /* Illegal opcode.  */
...

/* `si_code' values for SIGFPE signal.  */
enum
{
  FPE_INTDIV = 1,               /* Integer divide by zero.  */
...

/* `si_code' values for SIGSEGV signal.  */
enum
{
  SEGV_MAPERR = 1,              /* Address not mapped to object.  */
....

Signed-off-by: Lionel Landwerlin <address@hidden>
---
 linux-user/signal.c |   4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 5e30522..0d81106 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -441,9 +441,9 @@ static void host_signal_handler(int host_signum, siginfo_t 
*info,
     target_siginfo_t tinfo;
 
     /* the CPU emulator uses some host signals to detect exceptions,
-       we we forward to it some signals */
+       we forward to it some signals */
     if ((host_signum == SIGSEGV || host_signum == SIGBUS)
-        && info->si_code == SI_KERNEL) {
+        && info->si_code > 0) {
         if (cpu_signal_handler(host_signum, info, puc))
             return;
     }
 
-- 
1.5.6.5


-- 
Lione Landwerlin                                         

O p e n W i d e                    14, rue Gaillon 75002 Paris





reply via email to

[Prev in Thread] Current Thread [Next in Thread]