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

@ -82,9 +82,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc,
int *pr2)
{
int temp;
abi_ulong off, frame_addr = env->regs[R_SP];
unsigned long *gregs = uc->tuc_mcontext.gregs;
int err;
/* Always make any pending restarted system calls return -EINTR */
/* current->restart_block.fn = do_no_restart_syscall; */
@ -130,11 +128,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc,
__get_user(env->regs[R_RA], &gregs[23]);
__get_user(env->regs[R_SP], &gregs[28]);
off = offsetof(struct target_rt_sigframe, uc.tuc_stack);
err = do_sigaltstack(frame_addr + off, 0, get_sp_from_cpustate(env));
if (err == -EFAULT) {
return 1;
}
target_restore_altstack(&uc->tuc_stack, get_sp_from_cpustate(env));
*pr2 = env->regs[2];
return 0;