Просмотр исходного кода

arm: if we get into work_pending while returning to kernel mode, just go away

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>
Al Viro 13 лет назад
Родитель
Сommit
21c1176a72
2 измененных файлов с 3 добавлено и 9 удалено
  1. 3 0
      arch/arm/kernel/entry-common.S
  2. 0 9
      arch/arm/kernel/signal.c

+ 3 - 0
arch/arm/kernel/entry-common.S

@@ -56,7 +56,10 @@ work_pending:
 	/*
 	/*
 	 * TIF_SIGPENDING or TIF_NOTIFY_RESUME must've been set if we got here
 	 * TIF_SIGPENDING or TIF_NOTIFY_RESUME must've been set if we got here
 	 */
 	 */
+	ldr	r2, [sp, #S_PSR]
 	mov	r0, sp				@ 'regs'
 	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'
 	mov	r2, why				@ 'syscall'
 	tst	r1, #_TIF_SIGPENDING		@ delivering a signal?
 	tst	r1, #_TIF_SIGPENDING		@ delivering a signal?
 	movne	why, #0				@ prevent further restarts
 	movne	why, #0				@ prevent further restarts

+ 0 - 9
arch/arm/kernel/signal.c

@@ -608,15 +608,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
 	siginfo_t info;
 	siginfo_t info;
 	int signr;
 	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...
 	 * If we were from a system call, check for system call restarting...
 	 */
 	 */