]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
linux-user/sparc: Don't zero high half of PC, NPC, PSR in sigreturn
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 5 Nov 2020 21:23:14 +0000 (21:23 +0000)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 10 Nov 2020 06:54:22 +0000 (07:54 +0100)
The function do_sigreturn() tries to store the PC, NPC and PSR in
uint32_t local variables, which implicitly drops the high half of
these fields for 64-bit guests.

The usual effect was that a guest which used signals would crash on
return from a signal unless it was lucky enough to take it while the
PC was in the low 4GB of the address space.  In particular, Debian
/bin/dash and /bin/bash would segfault after executing external
commands.

Use abi_ulong, which is the type these fields all have in the
__siginfo_t struct.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201105212314.9628-4-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/sparc/signal.c

index c315704b38958b6f9dc05ad819b755f861dc257b..d12adc8e6ff98eef7fa816ecf6d5fb1029da2b60 100644 (file)
@@ -247,7 +247,7 @@ long do_sigreturn(CPUSPARCState *env)
 {
     abi_ulong sf_addr;
     struct target_signal_frame *sf;
-    uint32_t up_psr, pc, npc;
+    abi_ulong up_psr, pc, npc;
     target_sigset_t set;
     sigset_t host_set;
     int i;