Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3896625d0badd53dbc34d584861a36ba7eb4613f Commit: 3896625d0badd53dbc34d584861a36ba7eb4613f Parent: 99abaf51e25f7d4ac2081e5cdc1f01baa0543514 Author: Jeff Dike <[EMAIL PROTECTED]> AuthorDate: Tue Jan 30 14:36:17 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Tue Jan 30 16:01:35 2007 -0800
[PATCH] 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 <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Cc: Adrian Bunk <[EMAIL PROTECTED]> Cc: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]> Acked-by: Antoine Martin <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- arch/um/sys-i386/signal.c | 3 ++- arch/um/sys-x86_64/signal.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index 0709fc6..3f6acd6 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c @@ -219,7 +219,8 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig, unsigned long save_sp = PT_REGS_SP(regs); int err = 0; - stack_top &= -8UL; + /* This is the same calculation as i386 - ((sp + 4) & 15) == 0 */ + stack_top = ((stack_top + 4) & -16UL) - 4; frame = (struct sigframe __user *) 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 9edf114..af2f017 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c @@ -191,8 +191,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 __user *) ((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 __user *) ((unsigned long) frame - 128 - 8); if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) goto out; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html