linux-user: SIGSEGV from sigreturn need not be fatal
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 28 Jul 2016 15:44:49 +0000 (16:44 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Wed, 21 Sep 2016 19:01:45 +0000 (22:01 +0300)
commitc599d4d6d6e9bfdb64e54c33a22cb26e3496b96d
tree4f5db178fbb692ad5d8a3819476d0f3c57b51d5a
parent28298c912e2c379f2b7767b351beeb77f001f27f
linux-user: SIGSEGV from sigreturn need not be fatal

If the sigreturn syscall fails to read memory then this causes a
SIGSEGV, but this is not necessarily a fatal signal -- the guest
process can catch it.

We don't implement this correctly because the behaviour of QEMU's
force_sig() function has drifted away from the kernel function of the
same name -- ours now does "always do a guest core dump and abort
execution", whereas the kernel version simply forces the guest to
take a signal, which may or may not eventually cause a core dump.

Rename our force_sig() to dump_core_and_abort(), and provide a
force_sig() which acts more like the kernel version as the sigreturn
implementations expect it to.  Since force_sig() now returns, we must
update all the callsites to return -TARGET_QEMU_ESIGRETURN so that
the main loop doesn't change the guest registers before the signal
handler is invoked.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/signal.c