]> git.neil.brown.name Git - history.git/commitdiff
Always disable system call restart when invoking a signal handler.
authorLinus Torvalds <torvalds@home.osdl.org>
Tue, 11 Nov 2003 13:18:50 +0000 (05:18 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 11 Nov 2003 13:18:50 +0000 (05:18 -0800)
Otherwise, a restarted system call that gets interrupted before
the restart has taken effect by _another_ signal will potentially
restart the wrong system call.

arch/i386/kernel/signal.c

index 234f513779a82b68252add672e71905acb7d4ca2..0fcb9627050b287d334d2f6afb9f08a69b7e0b70 100644 (file)
@@ -504,12 +504,14 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
 {
        struct k_sigaction *ka = &current->sighand->action[sig-1];
 
+       /* Always make any pending restarted system calls return -EINTR */
+       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
        /* Are we from a system call? */
        if (regs->orig_eax >= 0) {
                /* If so, check system call restarting.. */
                switch (regs->eax) {
                        case -ERESTART_RESTARTBLOCK:
-                               current_thread_info()->restart_block.fn = do_no_restart_syscall;
                        case -ERESTARTNOHAND:
                                regs->eax = -EINTR;
                                break;