]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
uml: fix signal frame alignment
authorJeff Dike <jdike@addtoit.com>
Wed, 14 Feb 2007 19:37:44 +0000 (20:37 +0100)
committerAdrian Bunk <bunk@stusta.de>
Wed, 14 Feb 2007 19:37:44 +0000 (20:37 +0100)
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 <jdike@addtoit.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
arch/um/sys-i386/signal.c
arch/um/sys-x86_64/signal.c

index 7cd1a82dc8c24fd086cd8c3e3a82ef6433640673..a4a174c06e95f650ae79ecf2aa2db6bfbffc7b5b 100644 (file)
@@ -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;
index fe1d065332b11d33f215a8f4a43654be69aff7a9..84940ab1c45be54cdb47f885b706f6293c88d212 100644 (file)
@@ -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;