[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [Bug 1705118] Re: qemu user mode does not support catching
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [Bug 1705118] Re: qemu user mode does not support catching SIGSEGV on some architectures |
Date: |
Mon, 06 Nov 2017 17:33:10 -0000 |
This is an interesting collection of different bugs:
* s390x is missing masking operations, as you describe
* ppc is passing the PC of the offending insn, not the data address, into
si_addr
* sparc fails to record the address of a data fault and so passes 0 into
si_addr
* sparc also isn't implementing rt_sigaction correctly and so the calls in
your test program fail EINVAL (your test program doesn't check the return value
from sigaction, so it ploughs ahead and makes the faulting data access with the
SIG_DFL behaviour for SEGV, hence the uncaught SEGV).
I'm putting together some patches for these.
** Changed in: qemu
Status: New => Confirmed
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1705118
Title:
qemu user mode does not support catching SIGSEGV on some architectures
Status in QEMU:
Confirmed
Bug description:
The documentation
<https://qemu.weilnetz.de/doc/qemu-doc.html#Features> says that
qemu in user mode supports POSIX signal handling.
Catching SIGSEGV according to POSIX, however, does not work on
ppc, ppc64, ppc64le, s390x, sparc64.
It does work, however, on
aarch64, alpha, arm, hppa, m68k, mips, mips64, sh4.
How to reproduce:
The attached program runs fine (exits with code 0) on
- real hardware Linux/PowerPC64 (in 32-bit and 64-bit mode),
- real hardware Linux/PowerPC64LE,
- qemu-system-s390x emulated Linux/s390x,
- real hardware Linux/SPARC64.
$ gcc -O -Wall testsigsegv.c; ./a.out; echo $?
0
For ppc:
$ powerpc-linux-gnu-gcc-5 -O -Wall -static testsigsegv.c -o testsigsegv-ppc
$ ~/inst-qemu/2.9.0/bin/qemu-ppc testsigsegv-ppc
$ echo $?
3
For ppc64:
$ powerpc64-linux-gnu-gcc-5 -O -Wall -static testsigsegv.c -o
testsigsegv-ppc64
$ ~/inst-qemu/2.9.0/bin/qemu-ppc64 testsigsegv-ppc64
$ echo $?
3
For ppc64le:
$ powerpc64le-linux-gnu-gcc-5 -O -Wall -static testsigsegv.c -o
testsigsegv-ppc64le
$ ~/inst-qemu/2.9.0/bin/qemu-ppc64le testsigsegv-ppc64le
$ echo $?
3
For s390x:
$ s390x-linux-gnu-gcc-5 -O -Wall -static testsigsegv.c -o testsigsegv-s390x
$ ~/inst-qemu/2.9.0/bin/qemu-s390x testsigsegv-s390x
$ echo $?
3
$ s390x-linux-gnu-gcc-5 -O -Wall -static testsigsegv.c
-DAVOID_LINUX_S390X_COMPAT -o testsigsegv-s390x-a
$ ~/inst-qemu/2.9.0/bin/qemu-s390x testsigsegv-s390x-a
$ echo $?
0
So, the test fails here because the Linux/s390x kernel omits the least
significant 12 bits of the fault address in the 'si_addr' field. But
qemu-s390x is not compatible with the Linux/s390x behaviour: it puts
the complete fault address in the 'si_addr' field.
For sparc64:
$ sparc64-linux-gnu-gcc-5 -O -Wall -static testsigsegv.c -o
testsigsegv-sparc64
$ ~/inst-qemu/2.9.0/bin/qemu-sparc64 testsigsegv-sparc64
Segmentation fault (core dumped)
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1705118/+subscriptions