On Sat, Mar 03, 2007 at 01:18:54AM +0300, Oleg Nesterov wrote:
> On 03/02, John Reiser wrote:
> > Paul Mundt has commented on setup_rt_frame() and provided a patch which
> > bullet-proofs that area.  I will include that patch into the next revision.
> 
> Confused. I still think his patch incomplete. Don't we need the same check
> in setup_rt_frame() ?
> 
Yes, you're right. The patch is missing the proper restorer logic in the
setup_rt_frame() case. This should handle both of them, restoring the
previous logic when the VDSO is disabled.

Signed-off-by: Paul Mundt <[EMAIL PROTECTED]>

--

 arch/i386/kernel/signal.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 4f99e87..26c2497 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -350,7 +350,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
                        goto give_sigsegv;
        }
 
-       if (current->binfmt->hasvdso)
+       if (current->binfmt->hasvdso && current->mm->context.vdso)
                restorer = (void *)VDSO_SYM(&__kernel_sigreturn);
        else
                restorer = (void *)&frame->retcode;
@@ -449,17 +449,20 @@ static int setup_rt_frame(int sig, struct k_sigaction 
*ka, siginfo_t *info,
                goto give_sigsegv;
 
        /* Set up to return from userspace.  */
-       restorer = (void *)VDSO_SYM(&__kernel_rt_sigreturn);
+       if (current->binfmt->hasvdso && current->mm->context.vdso)
+               restorer = (void *)VDSO_SYM(&__kernel_rt_sigreturn);
+       else
+               restorer = (void *)&frame->retcode;
        if (ka->sa.sa_flags & SA_RESTORER)
                restorer = ka->sa.sa_restorer;
        err |= __put_user(restorer, &frame->pretcode);
-        
+
        /*
         * This is movl $,%eax ; int $0x80
         *
-        * WE DO NOT USE IT ANY MORE! It's only left here for historical
-        * reasons and because gdb uses it as a signature to notice
-        * signal handler stack frames.
+        * This is not used in the general case! It's left here for
+        * handling toggling of the VDSO state and because gdb uses it
+        * as a signature to notice signal handler stack frames.
         */
        err |= __put_user(0xb8, (char __user *)(frame->retcode+0));
        err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to