Commit c27852597829128a9c9d96d79ec454a83c6b0da5
1 parent
392c21802e
Exists in
master
and in
4 other branches
sparc: Prevent no-handler signal syscall restart recursion.
Explicitly clear the "in-syscall" bit when we have no signal handler and back up the program counters to back up the system call. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 3 changed files with 7 additions and 1 deletions Side-by-side Diff
arch/sparc/kernel/signal32.c
... | ... | @@ -616,7 +616,7 @@ |
616 | 616 | |
617 | 617 | flush_signal_insns(address); |
618 | 618 | } |
619 | - return; | |
619 | + return 0; | |
620 | 620 | |
621 | 621 | sigill: |
622 | 622 | do_exit(SIGILL); |
623 | 623 | |
... | ... | @@ -840,12 +840,14 @@ |
840 | 840 | regs->u_regs[UREG_I0] = orig_i0; |
841 | 841 | regs->tpc -= 4; |
842 | 842 | regs->tnpc -= 4; |
843 | + pt_regs_clear_syscall(regs); | |
843 | 844 | } |
844 | 845 | if (restart_syscall && |
845 | 846 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
846 | 847 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
847 | 848 | regs->tpc -= 4; |
848 | 849 | regs->tnpc -= 4; |
850 | + pt_regs_clear_syscall(regs); | |
849 | 851 | } |
850 | 852 | |
851 | 853 | /* If there's no signal to deliver, we just put the saved sigmask |
arch/sparc/kernel/signal_32.c
... | ... | @@ -580,12 +580,14 @@ |
580 | 580 | regs->u_regs[UREG_I0] = orig_i0; |
581 | 581 | regs->pc -= 4; |
582 | 582 | regs->npc -= 4; |
583 | + pt_regs_clear_syscall(regs); | |
583 | 584 | } |
584 | 585 | if (restart_syscall && |
585 | 586 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
586 | 587 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
587 | 588 | regs->pc -= 4; |
588 | 589 | regs->npc -= 4; |
590 | + pt_regs_clear_syscall(regs); | |
589 | 591 | } |
590 | 592 | |
591 | 593 | /* if there's no signal to deliver, we just put the saved sigmask |
arch/sparc/kernel/signal_64.c
... | ... | @@ -600,12 +600,14 @@ |
600 | 600 | regs->u_regs[UREG_I0] = orig_i0; |
601 | 601 | regs->tpc -= 4; |
602 | 602 | regs->tnpc -= 4; |
603 | + pt_regs_clear_syscall(regs); | |
603 | 604 | } |
604 | 605 | if (restart_syscall && |
605 | 606 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
606 | 607 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
607 | 608 | regs->tpc -= 4; |
608 | 609 | regs->tnpc -= 4; |
610 | + pt_regs_clear_syscall(regs); | |
609 | 611 | } |
610 | 612 | |
611 | 613 | /* If there's no signal to deliver, we just put the saved sigmask |