Skip to content

Commit

Permalink
PPC: fix segfault in signal handling code
Browse files Browse the repository at this point in the history
Removed h2g() macro around the ka->_sa_handler due to the _sa_handler being a
guest memory address.

Changed the __put_user to put_user as it was attempting to put a value at the
stack address but the new address is a guest memory address, __put_user is
for host memory addresses.

Signed-off-by: Samuel Seay <LightningTH@GMail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[agraf: change subject line, reformat commit message]
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
LightningTH authored and agraf committed Jan 7, 2013
1 parent 88a78d9 commit beb526b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions linux-user/signal.c
Expand Up @@ -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]);
Expand All @@ -4606,7 +4606,7 @@ 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);
err |= put_user(env->gpr[1], newsp, target_ulong);

if (err)
goto sigsegv;
Expand Down

0 comments on commit beb526b

Please sign in to comment.