aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2021-08-03 19:18:58 +0200
committerLaurent Vivier <laurent@vivier.eu>2021-08-05 12:15:44 +0200
commit0c40c18ecd564a5c3f27f1408aaf9848fe210349 (patch)
treef398fd241f65cd62090df8c1b58ffb6632c3d4fe /linux-user
parentbccabb3a5d60182645c7749e89f21a9ff307a9eb (diff)
downloadqemu-0c40c18ecd564a5c3f27f1408aaf9848fe210349.zip
qemu-0c40c18ecd564a5c3f27f1408aaf9848fe210349.tar.gz
qemu-0c40c18ecd564a5c3f27f1408aaf9848fe210349.tar.bz2
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>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/i386/signal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
index 8701774..841cd19 100644
--- a/linux-user/i386/signal.c
+++ b/linux-user/i386/signal.c
@@ -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);