From: Peter Maydell <peter.maydell@linaro.org>
To: Samuel Seay <lightningth@gmail.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Change to correct PowerPC on a 64bit host
Date: Wed, 2 Jan 2013 12:00:27 +0000 [thread overview]
Message-ID: <CAFEAcA8qORk2eAU+7EKWGeM3dycdnRwza2WF824=RGFEa+50Ug@mail.gmail.com> (raw)
In-Reply-To: <CADwyeC-DmT+ymSZ8UwTkui1r_ighLVcjnLTDY78uGNbicDsHcA@mail.gmail.com>
On 2 January 2013 04:58, Samuel Seay <lightningth@gmail.com> wrote:
> Attached is a patch for fixing bug #1052857. My local tests show it working
> properly on 32 and 64bit.
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -4584,7 +4584,7 @@ static void setup_frame(int sig, struct
target_sigaction *ka,
signal = current_exec_domain_sig(sig);
- err |= __put_user(h2g(ka->_sa_handler), &sc->handler);
+ err |= __put_user(ka->_sa_handler, &sc->handler);
err |= __put_user(set->sig[0], &sc->oldmask);
#if defined(TARGET_PPC64)
err |= __put_user(set->sig[0] >> 32, &sc->_unused[3]);
This looks OK...
@@ -4606,8 +4606,6 @@ static void setup_frame(int sig, struct
target_sigaction *ka,
/* Create a stack frame for the caller of the handler. */
newsp = frame_addr - SIGNAL_FRAMESIZE;
- err |= __put_user(env->gpr[1], (target_ulong *)(uintptr_t) newsp);
-
if (err)
goto sigsegv;
...but this bit doesn't. We need to save the old SP to the stack frame,
and your patch just skips this step. You're right that the line in question
is broken though; it has two problems:
* it's using newsp (a guest address) as an argument to __put_user(),
which wants a host address
* it's using __put_user() which works on locked addresses, but newsp
is below the area we locked with lock_user_struct earlier
Another dodgy line in this function:
env->gpr[4] = (target_ulong) h2g(sc);
Since sc is an offset into the struct returned by lock_user_struct(),
if DEBUG_REMAP is defined then we're passing the guest a pointer
to memory that is free()d by unlock_user_struct(). This should probably
be setting gpr[4] to frame_addr + offsetof(something) instead.
-- PMM
next prev parent reply other threads:[~2013-01-02 12:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-02 4:58 [Qemu-devel] [PATCH] Change to correct PowerPC on a 64bit host Samuel Seay
2013-01-02 11:44 ` Andreas Färber
2013-01-02 12:00 ` Peter Maydell [this message]
2013-01-02 13:01 ` Samuel Seay
2013-01-02 14:02 ` Peter Maydell
2013-01-02 14:34 ` Samuel Seay
2013-01-02 14:47 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2013-01-02 14:53 ` [Qemu-devel] " Peter Maydell
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='CAFEAcA8qORk2eAU+7EKWGeM3dycdnRwza2WF824=RGFEa+50Ug@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=lightningth@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).