[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-ppc] [PATCH] linux-user: fill target sigcontext s
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [Qemu-ppc] [PATCH] linux-user: fill target sigcontext struct accordingly |
Date: |
Wed, 1 Mar 2017 11:12:07 +1100 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Tue, Feb 28, 2017 at 11:22:54AM +0100, Laurent Vivier wrote:
> Le 28/02/2017 à 02:09, David Gibson a écrit :
> > On Wed, Feb 01, 2017 at 09:43:57PM +0100, Laurent Vivier wrote:
> >> Le 31/01/2017 à 23:05, Jose Ricardo Ziviani a écrit :
> >>> A segfault is noticed when an emulated program uses any of ucontext
> >>> regs fields. Risu detected this issue in the following operation when
> >>> handling a signal:
> >>> ucontext_t *uc = (ucontext_t*)uc;
> >>> uc->uc_mcontext.regs->nip += 4;
> >>>
> >>> but this works fine:
> >>> uc->uc_mcontext.gp_regs[PT_NIP] += 4;
> >>>
> >>> This patch set regs to a valid location as well as other sigcontext
> >>> fields.
> >>>
> >>> Signed-off-by: Jose Ricardo Ziviani <address@hidden>
> >>> ---
> >>> linux-user/signal.c | 5 +++++
> >>> 1 file changed, 5 insertions(+)
> >>>
> >>> diff --git a/linux-user/signal.c b/linux-user/signal.c
> >>> index 5064de0..8209539 100644
> >>> --- a/linux-user/signal.c
> >>> +++ b/linux-user/signal.c
> >>> @@ -5155,6 +5155,7 @@ static void setup_rt_frame(int sig, struct
> >>> target_sigaction *ka,
> >>> target_ulong rt_sf_addr, newsp = 0;
> >>> int i, err = 0;
> >>> #if defined(TARGET_PPC64)
> >>> + struct target_sigcontext *sc = 0;
> >>> struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
> >>> #endif
> >>>
> >>> @@ -5183,6 +5184,10 @@ static void setup_rt_frame(int sig, struct
> >>> target_sigaction *ka,
> >>> #if defined(TARGET_PPC64)
> >>> mctx = &rt_sf->uc.tuc_sigcontext.mcontext;
> >>> trampptr = &rt_sf->trampoline[0];
> >>> +
> >>> + sc = &rt_sf->uc.tuc_sigcontext;
> >>> + __put_user(h2g(mctx), &sc->regs);
> >>> + __put_user(sig, &sc->signal);
> >>> #else
> >>> mctx = &rt_sf->uc.tuc_mcontext;
> >>> trampptr = (uint32_t *)&rt_sf->uc.tuc_mcontext.tramp;
> >>>
> >>
> >> Reviewed-by: Laurent Vivier <address@hidden>
> >>
> >> This is correct, but QEMU and kernel implementation are really
> >> different.
> >
>
> Hi David,
>
> > Laurent, I'm a bit clear on what the upshot is here.
> >
> > Should I merge the patch above?
>
> I've already included this patch in a linux-user pull request a couple
> of weeks ago, and it is now in the master.
>
> So you have nothing to do :)
Excellent, thanks for the clarification.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature