Commit 4e7affd3 authored by Linus Torvalds's avatar Linus Torvalds

Always disable system call restart when invoking a signal handler.

Otherwise, a restarted system call that gets interrupted before
the restart has taken effect by _another_ signal will potentially
restart the wrong system call.
parent 205c09cd
...@@ -504,12 +504,14 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset, ...@@ -504,12 +504,14 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
{ {
struct k_sigaction *ka = &current->sighand->action[sig-1]; 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? */ /* Are we from a system call? */
if (regs->orig_eax >= 0) { if (regs->orig_eax >= 0) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
switch (regs->eax) { switch (regs->eax) {
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
current_thread_info()->restart_block.fn = do_no_restart_syscall;
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
regs->eax = -EINTR; regs->eax = -EINTR;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment