From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-devel@nongnu.org, Ilya Leoshkevich <iii@linux.ibm.com>,
Andreas Krebbel <krebbel@linux.ibm.com>
Subject: [PATCH] linux-user: fix guest/host address mixup in i386 setup_rt_frame()
Date: Tue, 3 Aug 2021 19:18:58 +0200 [thread overview]
Message-ID: <20210803171858.148394-1-iii@linux.ibm.com> (raw)
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>
---
linux-user/i386/signal.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
index 8701774e37..841cd19651 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);
--
2.31.1
next reply other threads:[~2021-08-03 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 17:18 Ilya Leoshkevich [this message]
2021-08-03 21:03 ` [PATCH] linux-user: fix guest/host address mixup in i386 setup_rt_frame() Richard Henderson
2021-08-05 10:17 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210803171858.148394-1-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=krebbel@linux.ibm.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).