From 0ec7c9f826a86a2a24101192e6f5f804ed8d7021 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Wed, 14 Feb 2007 20:37:44 +0100 Subject: uml: fix signal frame alignment Use the same signal frame alignment calculations as the underlying architecture. x86_64 appeared to do this, but the "- 8" was really subtracting 8 * sizeof(struct rt_sigframe) rather than 8 bytes. UML/i386 might have been OK, but I changed the calculation to match i386 just to be sure. Signed-off-by: Jeff Dike Signed-off-by: Adrian Bunk --- arch/um/sys-i386/signal.c | 2 +- arch/um/sys-x86_64/signal.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index 7cd1a82dc8c2..a4a174c06e95 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c @@ -209,7 +209,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig, void *restorer; int err = 0; - stack_top &= -8UL; + stack_top = ((stack_top + 4) & -16UL) - 4; frame = (struct sigframe *) stack_top - 1; if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) return 1; diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index fe1d065332b1..84940ab1c45b 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c @@ -174,8 +174,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, struct task_struct *me = current; frame = (struct rt_sigframe __user *) - round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; - frame = (struct rt_sigframe *) ((unsigned long) frame - 128); + round_down(stack_top - sizeof(struct rt_sigframe), 16); + /* Subtract 128 for a red zone and 8 for proper alignment */ + frame = (struct rt_sigframe *) ((unsigned long) frame - 128 - 8); if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) goto out; -- cgit v1.2.3