diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-19 12:48:50 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-07-28 06:11:52 -0400 |
commit | 6628521784d1da3b7354c6b6e8499e19ab46a3d1 (patch) | |
tree | cde8876156ebe9999bdc2156f76d18b15293c754 /arch | |
parent | 81783786d5cf4aa0d3e15bb0fac856aa8ebf1a76 (diff) |
ARM: 7474/1: get rid of TIF_SYSCALL_RESTARTSYS
just let do_work_pending() return 1 on normal local restarts and
-1 on those that had been caused by ERESTART_RESTARTBLOCK (and 0
is still "all done, sod off to userland now"). And let the asm
glue flip scno to restart_syscall(2) one if it got negative from
us...
[will: resolved conflicts with audit fixes]
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/thread_info.h | 5 | ||||
-rw-r--r-- | arch/arm/kernel/entry-common.S | 3 | ||||
-rw-r--r-- | arch/arm/kernel/ptrace.c | 7 | ||||
-rw-r--r-- | arch/arm/kernel/signal.c | 15 |
4 files changed, 10 insertions, 20 deletions
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index b79f8e97f775..af7b0bda3355 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -148,7 +148,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, | |||
148 | #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ | 148 | #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ |
149 | #define TIF_SYSCALL_TRACE 8 | 149 | #define TIF_SYSCALL_TRACE 8 |
150 | #define TIF_SYSCALL_AUDIT 9 | 150 | #define TIF_SYSCALL_AUDIT 9 |
151 | #define TIF_SYSCALL_RESTARTSYS 10 | ||
152 | #define TIF_POLLING_NRFLAG 16 | 151 | #define TIF_POLLING_NRFLAG 16 |
153 | #define TIF_USING_IWMMXT 17 | 152 | #define TIF_USING_IWMMXT 17 |
154 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 153 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
@@ -164,11 +163,9 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, | |||
164 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | 163 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
165 | #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) | 164 | #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) |
166 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | 165 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) |
167 | #define _TIF_SYSCALL_RESTARTSYS (1 << TIF_SYSCALL_RESTARTSYS) | ||
168 | 166 | ||
169 | /* Checks for any syscall work in entry-common.S */ | 167 | /* Checks for any syscall work in entry-common.S */ |
170 | #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ | 168 | #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT) |
171 | _TIF_SYSCALL_RESTARTSYS) | ||
172 | 169 | ||
173 | /* | 170 | /* |
174 | * Change these and you break ASM code in entry-common.S | 171 | * Change these and you break ASM code in entry-common.S |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 8ae58c47dce6..2909bbcaa0d1 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -54,8 +54,9 @@ work_pending: | |||
54 | mov r0, sp @ 'regs' | 54 | mov r0, sp @ 'regs' |
55 | mov r2, why @ 'syscall' | 55 | mov r2, why @ 'syscall' |
56 | bl do_work_pending | 56 | bl do_work_pending |
57 | tst r0, #1 | 57 | cmp r0, #0 |
58 | beq no_work_pending | 58 | beq no_work_pending |
59 | movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE) | ||
59 | ldmia sp, {r0 - r6} @ have to reload r0 - r6 | 60 | ldmia sp, {r0 - r6} @ have to reload r0 - r6 |
60 | b local_restart @ ... and off we go | 61 | b local_restart @ ... and off we go |
61 | 62 | ||
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index efd25d65ae13..3e0fc5f7ed4b 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -941,12 +941,7 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno, | |||
941 | 941 | ||
942 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | 942 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) |
943 | { | 943 | { |
944 | int ret; | 944 | int ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); |
945 | |||
946 | if (test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS)) | ||
947 | scno = __NR_restart_syscall - __NR_SYSCALL_BASE; | ||
948 | |||
949 | ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); | ||
950 | audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, | 945 | audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, |
951 | regs->ARM_r2, regs->ARM_r3); | 946 | regs->ARM_r2, regs->ARM_r3); |
952 | return ret; | 947 | return ret; |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 99851cb9591d..f27789e4e38a 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -591,7 +591,7 @@ static int do_signal(struct pt_regs *regs, int syscall) | |||
591 | */ | 591 | */ |
592 | switch (retval) { | 592 | switch (retval) { |
593 | case -ERESTART_RESTARTBLOCK: | 593 | case -ERESTART_RESTARTBLOCK: |
594 | restart++; | 594 | restart -= 2; |
595 | case -ERESTARTNOHAND: | 595 | case -ERESTARTNOHAND: |
596 | case -ERESTARTSYS: | 596 | case -ERESTARTSYS: |
597 | case -ERESTARTNOINTR: | 597 | case -ERESTARTNOINTR: |
@@ -629,13 +629,9 @@ static int do_signal(struct pt_regs *regs, int syscall) | |||
629 | return 0; | 629 | return 0; |
630 | } | 630 | } |
631 | 631 | ||
632 | if (unlikely(restart)) { | ||
633 | if (restart > 1) | ||
634 | set_thread_flag(TIF_SYSCALL_RESTARTSYS); | ||
635 | regs->ARM_pc = continue_addr; | ||
636 | } | ||
637 | |||
638 | restore_saved_sigmask(); | 632 | restore_saved_sigmask(); |
633 | if (unlikely(restart)) | ||
634 | regs->ARM_pc = continue_addr; | ||
639 | return restart; | 635 | return restart; |
640 | } | 636 | } |
641 | 637 | ||
@@ -650,13 +646,14 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) | |||
650 | return 0; | 646 | return 0; |
651 | local_irq_enable(); | 647 | local_irq_enable(); |
652 | if (thread_flags & _TIF_SIGPENDING) { | 648 | if (thread_flags & _TIF_SIGPENDING) { |
653 | if (unlikely(do_signal(regs, syscall))) { | 649 | int restart = do_signal(regs, syscall); |
650 | if (unlikely(restart)) { | ||
654 | /* | 651 | /* |
655 | * Restart without handlers. | 652 | * Restart without handlers. |
656 | * Deal with it without leaving | 653 | * Deal with it without leaving |
657 | * the kernel space. | 654 | * the kernel space. |
658 | */ | 655 | */ |
659 | return 1; | 656 | return restart; |
660 | } | 657 | } |
661 | syscall = 0; | 658 | syscall = 0; |
662 | } else { | 659 | } else { |