QEMU uses SIGSEGV for its own purposes (notably for detection of guest writes to pages marked read-only because we have cached translated code from them), so allowing the guest to block SIGSEGV is a bad idea. Instead we wrap sigprocmask() uses for guest-derived signal masks and just track whether the guest thinks SIGSEGV is blocked rather than really blocking it.
This is an updated version of a patchset sent by Alex Barcelo a year or so ago; changes are: * use the wrapper for sigprocmask uses in signal.c where we set the signal mask on entry and exit from a guest signal handler * rather than just dropping SIGSEGV from the signal mask, track the guest state in a TaskState flag Although the need for this patchset is more noticable with AArch64 guests (because at the moment we use trampoline code on the stack for handling return from signal, which means that pages in the stack are often marked read-only because we translate the trampoline code and then written to in the normal course of guest execution) it is generally applicable to all architectures. [Eventually we should implement emulation of the vdso for AArch64, at which point we can put the signal-return trampoline in that, as the real kernel does; then there will be less of these SEGVs.] Alex Barcelo (1): linux-user: Add wrapper for guest uses of sigprocmask function Peter Maydell (1): linux-user: Don't allow guest to block SIGSEGV linux-user/qemu.h | 2 + linux-user/signal.c | 118 ++++++++++++++++++++++++++++++++++++++++----------- linux-user/syscall.c | 14 +++--- 3 files changed, 103 insertions(+), 31 deletions(-) -- 1.9.0