arm: if we get into work_pending while returning to kernel mode, just go away
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 28 Apr 2012 21:51:42 +0000 (17:51 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 21 May 2012 18:38:24 +0000 (14:38 -0400)
checking in do_signal() is pointless - if we get there with !user_mode(regs)
(and we might), we'll end up looping indefinitely.  Check in work_pending
and break out of the loop if so.

Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/arm/kernel/entry-common.S
arch/arm/kernel/signal.c

index 82aaf0aeb85d2723285668b226e53b8e12b63f12..b669b49d7cc412026c46338a5c03079f26051b91 100644 (file)
@@ -56,7 +56,10 @@ work_pending:
        /*
         * TIF_SIGPENDING or TIF_NOTIFY_RESUME must've been set if we got here
         */
+       ldr     r2, [sp, #S_PSR]
        mov     r0, sp                          @ 'regs'
+       tst     r2, #15                         @ are we returning to user mode?
+       bne     no_work_pending                 @ no?  just leave, then...
        mov     r2, why                         @ 'syscall'
        tst     r1, #_TIF_SIGPENDING            @ delivering a signal?
        movne   why, #0                         @ prevent further restarts
index 3b37c14c47f52d2f9a730a7c55f9affb7fcad4da..6b37d4ddf0b6cf1f13539d5d6f1060966541c4b4 100644 (file)
@@ -608,15 +608,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
        siginfo_t info;
        int signr;
 
-       /*
-        * We want the common case to go fast, which
-        * is why we may in certain cases get here from
-        * kernel mode. Just return without doing anything
-        * if so.
-        */
-       if (!user_mode(regs))
-               return;
-
        /*
         * If we were from a system call, check for system call restarting...
         */