Commit 9747dd6f authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: fix 32-bit signal frame back link

When the kernel creates a signal frame on the user stack, it puts the
old stack pointer value at the beginning so that the signal frame is
linked into the chain of stack frames like any other frame.
Unfortunately, for 32-bit processes we are writing the old stack
pointer as a 64-bit value rather than a 32-bit value, and the process
sees that as a null pointer, since it only looks at the first 32 bits,
which are zero since ppc is bigendian and the stack pointer is below
4GB.  This bug is in SLES9 and RHEL4 too, hence the ccs.

This patch fixes the bug by making the signal code write the old stack
pointer as a u32 instead of an unsigned long.
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a6ad57fb
...@@ -657,7 +657,7 @@ static int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, ...@@ -657,7 +657,7 @@ static int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
/* Save user registers on the stack */ /* Save user registers on the stack */
frame = &rt_sf->uc.uc_mcontext; frame = &rt_sf->uc.uc_mcontext;
if (put_user(regs->gpr[1], (unsigned long __user *)newsp)) if (put_user(regs->gpr[1], (u32 __user *)newsp))
goto badframe; goto badframe;
if (vdso32_rt_sigtramp && current->thread.vdso_base) { if (vdso32_rt_sigtramp && current->thread.vdso_base) {
...@@ -842,7 +842,7 @@ static int handle_signal32(unsigned long sig, struct k_sigaction *ka, ...@@ -842,7 +842,7 @@ static int handle_signal32(unsigned long sig, struct k_sigaction *ka,
regs->link = (unsigned long) frame->mctx.tramp; regs->link = (unsigned long) frame->mctx.tramp;
} }
if (put_user(regs->gpr[1], (unsigned long __user *)newsp)) if (put_user(regs->gpr[1], (u32 __user *)newsp))
goto badframe; goto badframe;
regs->gpr[1] = (unsigned long) newsp; regs->gpr[1] = (unsigned long) newsp;
regs->gpr[3] = sig; regs->gpr[3] = sig;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment