diff mbox

[2/2] linux-user: fix do_rt_sigreturn on m68k linux userspace emulation

Message ID 20170225110517.2832-3-laurent@vivier.eu (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Vivier Feb. 25, 2017, 11:05 a.m. UTC
From: Michael Karcher <karcher@physik.fu-berlin.de>

do_rt_sigreturn uses an uninitialised local variable instead of fetching
the old signal mask directly from the signal frame when restoring the mask,
so the signal mask is undefined after do_rt_sigreturn. As the signal
frame data is in target-endian order, target_to_host_sigset instead of
target_to_host_sigset_internal is required.

do_sigreturn is correct in using target_to_host_sigset_internal, because
get_user already did the endianness conversion.

Signed-off-by: Michael Karcher <karcher@physik.fu-berlin.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/signal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Richard Henderson Feb. 28, 2017, 12:32 a.m. UTC | #1
On 02/25/2017 10:05 PM, Laurent Vivier wrote:
> From: Michael Karcher <karcher@physik.fu-berlin.de>
>
> do_rt_sigreturn uses an uninitialised local variable instead of fetching
> the old signal mask directly from the signal frame when restoring the mask,
> so the signal mask is undefined after do_rt_sigreturn. As the signal
> frame data is in target-endian order, target_to_host_sigset instead of
> target_to_host_sigset_internal is required.
>
> do_sigreturn is correct in using target_to_host_sigset_internal, because
> get_user already did the endianness conversion.
>
> Signed-off-by: Michael Karcher <karcher@physik.fu-berlin.de>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/signal.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~
diff mbox

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index df452ba..8382561 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -5670,14 +5670,13 @@  long do_rt_sigreturn(CPUM68KState *env)
 {
     struct target_rt_sigframe *frame;
     abi_ulong frame_addr = env->aregs[7] - 4;
-    target_sigset_t target_set;
     sigset_t set;
 
     trace_user_do_rt_sigreturn(env, frame_addr);
     if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1))
         goto badframe;
 
-    target_to_host_sigset_internal(&set, &target_set);
+    target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
     set_sigmask(&set);
 
     /* restore registers */