linux-user: fix guest/host address mixup in i386 setup_rt_frame()

setup_rt_frame() passes siginfo and ucontext host addresses to guest
signal handlers, causing problems when e.g. emulating x86_64 on s390x.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210803171858.148394-1-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Ilya Leoshkevich 2021-08-03 19:18:58 +02:00 committed by Laurent Vivier
parent bccabb3a5d
commit 0c40c18ecd

View File

@ -436,13 +436,13 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
#ifndef TARGET_X86_64
env->regs[R_EAX] = sig;
env->regs[R_EDX] = (unsigned long)&frame->info;
env->regs[R_ECX] = (unsigned long)&frame->uc;
env->regs[R_EDX] = frame_addr + offsetof(struct rt_sigframe, info);
env->regs[R_ECX] = frame_addr + offsetof(struct rt_sigframe, uc);
#else
env->regs[R_EAX] = 0;
env->regs[R_EDI] = sig;
env->regs[R_ESI] = (unsigned long)&frame->info;
env->regs[R_EDX] = (unsigned long)&frame->uc;
env->regs[R_ESI] = frame_addr + offsetof(struct rt_sigframe, info);
env->regs[R_EDX] = frame_addr + offsetof(struct rt_sigframe, uc);
#endif
cpu_x86_load_seg(env, R_DS, __USER_DS);