* [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation
@ 2009-01-03 12:36 Lionel Landwerlin
2009-01-03 12:50 ` Lionel Landwerlin
0 siblings, 1 reply; 3+ messages in thread
From: Lionel Landwerlin @ 2009-01-03 12:36 UTC (permalink / raw)
To: qemu-devel
Let's compile a very simple program :
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
int *i = NULL;
sleep (1);
*i = 42;
return EXIT_SUCCESS;
}
Now run this program under qemu with gdbstub :
qemu -g 1234 ./test-segfault
Run gdb on the same program, connect it to qemu and start execution.
This program will raise a SIGSEGV signal and qemu will be locked in an
endless loop. Gdb will never be notify by qemu of SIGSEGV signal.
The following post provides a fix for that.
Regards,
--
Lione Landwerlin
O p e n W i d e 14, rue Gaillon 75002 Paris
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation
2009-01-03 12:36 [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation Lionel Landwerlin
@ 2009-01-03 12:50 ` Lionel Landwerlin
2009-01-03 13:14 ` Aurelien Jarno
0 siblings, 1 reply; 3+ messages in thread
From: Lionel Landwerlin @ 2009-01-03 12:50 UTC (permalink / raw)
To: qemu-devel
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 <lionel.landwerlin@openwide.fr>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation
2009-01-03 12:50 ` Lionel Landwerlin
@ 2009-01-03 13:14 ` Aurelien Jarno
0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2009-01-03 13:14 UTC (permalink / raw)
To: Lionel Landwerlin; +Cc: qemu-devel
On Sat, Jan 03, 2009 at 01:50:39PM +0100, Lionel Landwerlin wrote:
> 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
>
We were working on the same thing at the same time, but you has been
faster :) Patch applied, thanks.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-03 13:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-03 12:36 [Qemu-devel] [PATCH] Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in user emulation Lionel Landwerlin
2009-01-03 12:50 ` Lionel Landwerlin
2009-01-03 13:14 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).