summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-07-19 17:48:50 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-07-28 11:11:52 +0100
commit6628521784d1da3b7354c6b6e8499e19ab46a3d1 (patch)
treecde8876156ebe9999bdc2156f76d18b15293c754
parent81783786d5cf4aa0d3e15bb0fac856aa8ebf1a76 (diff)
downloadlinux-3.10-6628521784d1da3b7354c6b6e8499e19ab46a3d1.tar.gz
linux-3.10-6628521784d1da3b7354c6b6e8499e19ab46a3d1.tar.bz2
linux-3.10-6628521784d1da3b7354c6b6e8499e19ab46a3d1.zip
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>
-rw-r--r--arch/arm/include/asm/thread_info.h5
-rw-r--r--arch/arm/kernel/entry-common.S3
-rw-r--r--arch/arm/kernel/ptrace.c7
-rw-r--r--arch/arm/kernel/signal.c15
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 b79f8e97f77..af7b0bda335 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 *,
#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
#define TIF_SYSCALL_TRACE 8
#define TIF_SYSCALL_AUDIT 9
-#define TIF_SYSCALL_RESTARTSYS 10
#define TIF_POLLING_NRFLAG 16
#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
@@ -164,11 +163,9 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
-#define _TIF_SYSCALL_RESTARTSYS (1 << TIF_SYSCALL_RESTARTSYS)
/* Checks for any syscall work in entry-common.S */
-#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
- _TIF_SYSCALL_RESTARTSYS)
+#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT)
/*
* 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 8ae58c47dce..2909bbcaa0d 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -54,8 +54,9 @@ work_pending:
mov r0, sp @ 'regs'
mov r2, why @ 'syscall'
bl do_work_pending
- tst r0, #1
+ cmp r0, #0
beq no_work_pending
+ movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)
ldmia sp, {r0 - r6} @ have to reload r0 - r6
b local_restart @ ... and off we go
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index efd25d65ae1..3e0fc5f7ed4 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,
asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
{
- int ret;
-
- if (test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS))
- scno = __NR_restart_syscall - __NR_SYSCALL_BASE;
-
- ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
+ int ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
regs->ARM_r2, regs->ARM_r3);
return ret;
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 99851cb9591..f27789e4e38 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)
*/
switch (retval) {
case -ERESTART_RESTARTBLOCK:
- restart++;
+ restart -= 2;
case -ERESTARTNOHAND:
case -ERESTARTSYS:
case -ERESTARTNOINTR:
@@ -629,13 +629,9 @@ static int do_signal(struct pt_regs *regs, int syscall)
return 0;
}
- if (unlikely(restart)) {
- if (restart > 1)
- set_thread_flag(TIF_SYSCALL_RESTARTSYS);
- regs->ARM_pc = continue_addr;
- }
-
restore_saved_sigmask();
+ if (unlikely(restart))
+ regs->ARM_pc = continue_addr;
return restart;
}
@@ -650,13 +646,14 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
return 0;
local_irq_enable();
if (thread_flags & _TIF_SIGPENDING) {
- if (unlikely(do_signal(regs, syscall))) {
+ int restart = do_signal(regs, syscall);
+ if (unlikely(restart)) {
/*
* Restart without handlers.
* Deal with it without leaving
* the kernel space.
*/
- return 1;
+ return restart;
}
syscall = 0;
} else {