linux-user: Use target_restore_altstack in all sigreturn

Note that target_restore_altstack uses the host memory
pointer that we have already verified, so TARGET_EFAULT
is not a possible return value.

Note that using -EFAULT was a bug.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210426025334.1168495-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Richard Henderson 2021-04-25 19:53:11 -07:00 committed by Laurent Vivier
parent 92bad94836
commit 56384cf3ad
16 changed files with 18 additions and 81 deletions

View file

@ -685,11 +685,7 @@ static int do_sigframe_return_v2(CPUARMState *env,
}
}
if (do_sigaltstack(context_addr
+ offsetof(struct target_ucontext_v2, tuc_stack),
0, get_sp_from_cpustate(env)) == -EFAULT) {
return 1;
}
target_restore_altstack(&uc->tuc_stack, get_sp_from_cpustate(env));
#if 0
/* Send SIGTRAP if we're single-stepping */
@ -773,8 +769,7 @@ static long do_rt_sigreturn_v1(CPUARMState *env)
goto badframe;
}
if (do_sigaltstack(frame_addr + offsetof(struct rt_sigframe_v1, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT)
goto badframe;
target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env));
#if 0
/* Send SIGTRAP if we're single-stepping */