From: Stephen Rothwell Date: Fri, 6 Jul 2012 00:32:57 +0000 (+1000) Subject: Revert "arm: get rid of TIF_SYSCALL_RESTARTSYS" X-Git-Tag: next-20120724~4^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fcfc819686ce6edf70f4ddfb5e16f0f036c2797c;p=karo-tx-linux.git Revert "arm: get rid of TIF_SYSCALL_RESTARTSYS" This reverts commit 76c3f4da3ee47b68304dbe0f64e86562e7945bf3. requested by Russell King. --- diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index b2d6b412172d..8564a6dcb0bc 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -148,6 +148,7 @@ 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_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 20 @@ -161,9 +162,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #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) +#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ + _TIF_SYSCALL_RESTARTSYS) /* * 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 45046b5506eb..0e647da6a792 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -54,10 +54,10 @@ work_pending: mov r0, sp @ 'regs' mov r2, why @ 'syscall' bl do_work_pending - cmp r0, #0 + tst r0, #1 beq no_work_pending - movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE) - ldmia sp, {r0 - r5} @ have to reload r0 - r5 + mov r0, sp @ pointer to regs + ldmia r0, {r0 - r5} @ have to reload r0 - r5 b local_restart @ ... and off we go /* diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index fc86b76537ee..5700a7ae7f0b 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -918,6 +918,8 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); + if (why == 0 && test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS)) + scno = __NR_restart_syscall - __NR_SYSCALL_BASE; if (!test_thread_flag(TIF_SYSCALL_TRACE)) return scno; diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 56f72d257ebd..c4368c67b042 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -590,7 +590,7 @@ static int do_signal(struct pt_regs *regs, int syscall) */ switch (retval) { case -ERESTART_RESTARTBLOCK: - restart -= 2; + restart++; case -ERESTARTNOHAND: case -ERESTARTSYS: case -ERESTARTNOINTR: @@ -628,9 +628,13 @@ static int do_signal(struct pt_regs *regs, int syscall) return 0; } - restore_saved_sigmask(); - if (unlikely(restart)) + if (unlikely(restart)) { + if (restart > 1) + set_thread_flag(TIF_SYSCALL_RESTARTSYS); regs->ARM_pc = continue_addr; + } + + restore_saved_sigmask(); return restart; } @@ -645,14 +649,13 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) return 0; local_irq_enable(); if (thread_flags & _TIF_SIGPENDING) { - int restart = do_signal(regs, syscall); - if (unlikely(restart)) { + if (unlikely(do_signal(regs, syscall))) { /* * Restart without handlers. * Deal with it without leaving * the kernel space. */ - return restart; + return 1; } syscall = 0; } else {