From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LJ5xm-0003eo-Ip for qemu-devel@nongnu.org; Sat, 03 Jan 2009 07:50:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LJ5xl-0003d6-Iq for qemu-devel@nongnu.org; Sat, 03 Jan 2009 07:50:46 -0500 Received: from [199.232.76.173] (port=60817 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJ5xl-0003cv-D0 for qemu-devel@nongnu.org; Sat, 03 Jan 2009 07:50:45 -0500 Received: from soufre.accelance.net ([213.162.48.15]:49913) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LJ5xk-0000WX-JB for qemu-devel@nongnu.org; Sat, 03 Jan 2009 07:50:44 -0500 Received: from [192.168.0.3] (potipota.net [88.168.176.51]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 0D7FB4509B for ; Sat, 3 Jan 2009 13:50:42 +0100 (CET) Subject: Re: [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation From: Lionel Landwerlin In-Reply-To: <1230986219.3814.13.camel@cocoduo.atr> References: <1230986219.3814.13.camel@cocoduo.atr> Content-Type: text/plain; charset=UTF-8 Date: Sat, 03 Jan 2009 13:50:39 +0100 Message-Id: <1230987039.3814.16.camel@cocoduo.atr> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 =3D=3D 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-generat= ed signals. */ there is a lot of enums for that, all starting at positives values : /* `si_code' values for SIGILL signal. */ enum { ILL_ILLOPC =3D 1, /* Illegal opcode. */ ... /* `si_code' values for SIGFPE signal. */ enum { FPE_INTDIV =3D 1, /* Integer divide by zero. */ ... /* `si_code' values for SIGSEGV signal. */ enum { SEGV_MAPERR =3D 1, /* Address not mapped to object. */ .... Signed-off-by: Lionel Landwerlin --- 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, sigi= nfo_t *info, target_siginfo_t tinfo; =20 /* 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 =3D=3D SIGSEGV || host_signum =3D=3D SIGBUS) - && info->si_code =3D=3D SI_KERNEL) { + && info->si_code > 0) { if (cpu_signal_handler(host_signum, info, puc)) return; } =20 --=20 1.5.6.5 --=20 =EF=BB=BFLione Landwerlin =20 =EF=BB=BF O p e n W i d e 14, rue Gaillon 75002 Paris