From: Laurent Vivier <laurent@vivier.eu>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-devel@nongnu.org, Andreas Krebbel <krebbel@linux.ibm.com>
Subject: Re: [PATCH] linux-user: fix guest/host address mixup in i386 setup_rt_frame()
Date: Thu, 5 Aug 2021 12:17:03 +0200 [thread overview]
Message-ID: <35224ebf-9b2b-d5bf-dbef-04e798d952cc@vivier.eu> (raw)
In-Reply-To: <20210803171858.148394-1-iii@linux.ibm.com>
Le 03/08/2021 à 19:18, Ilya Leoshkevich a écrit :
> 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);
>
Applied to my linux-user-for-6.1 branch.
Thanks,
Laurent
prev parent reply other threads:[~2021-08-05 10:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 17:18 [PATCH] linux-user: fix guest/host address mixup in i386 setup_rt_frame() Ilya Leoshkevich
2021-08-03 21:03 ` Richard Henderson
2021-08-05 10:17 ` Laurent Vivier [this message]
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=35224ebf-9b2b-d5bf-dbef-04e798d952cc@vivier.eu \
--to=laurent@vivier.eu \
--cc=borntraeger@de.ibm.com \
--cc=iii@linux.ibm.com \
--cc=krebbel@linux.ibm.com \
--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).