MIPS: Fix endless loop when processing signals for kernel tasks

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

MIPS: Fix endless loop when processing signals for kernel tasks

linux-mips main mailing list
Author: Dmitry Adamushko <[hidden email]> Thu Apr 5 20:37:34 2012 +0200
Comitter: Ralf Baechle <[hidden email]> Wed Nov 28 16:06:32 2012 +0100
Commit: 0018ff2660fcbbfb08c1a7bcbb0037dfeb3e3373
Gitweb: http://git.linux-mips.org/g/ralf/linux/0018ff2660fc
Branch: master

The problem occurs [1] when a kernel-mode task returns from a system
call with a pending signal.

A real-life scenario is a child of 'khelper' returning from a failed
kernel_execve() in ____call_usermodehelper() [ kernel/kmod.c ].
kernel_execve() fails due to a pending SIGKILL, which is the result of
"kill -9 -1" (at least, busybox's init does it upon reboot).

The loop is as follows:

* syscall_exit_work:
 - work_pending:            // start_of_the_loop
 - work_notifysig:
   - do_notify_resume()
     - do_signal()
       - if (!user_mode(regs)) return;
 - resume_userspace         // TIF_SIGPENDING is still set
 - work_pending             // so we call work_pending => goto
                            // start_of_the_loop

More information can be found in another LKML thread:
http://www.serverphorums.com/read.php?12,457826

[1] The problem was also reproduced on !CONFIG_VM86 x86, and the
following fix was accepted.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=29a2e2836ff9ea65a603c89df217f4198973a74f

Signed-off-by: Dmitry Adamushko <[hidden email]>
Cc: [hidden email]
Patchwork: https://patchwork.linux-mips.org/patch/3571/
Signed-off-by: Ralf Baechle <[hidden email]>

---

 arch/mips/kernel/entry.S |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)