]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ptrace: revert "Prepare to fix racy accesses on task breakpoints"
authorOleg Nesterov <oleg@redhat.com>
Fri, 7 Jun 2013 00:09:34 +0000 (10:09 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 17 Jun 2013 08:20:15 +0000 (18:20 +1000)
This reverts commit bf26c018490c2fce ("Prepare to fix racy accesses on
task breakpoints").

The patch was fine but we can no longer race with SIGKILL after 9899d11f
("ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL"),
the __TASK_TRACED tracee can't be woken up and ->ptrace_bps[] can't go
away.

Now that ptrace_get_breakpoints/ptrace_put_breakpoints have no callers, we
can kill them and remove task->ptrace_bp_refcnt.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Michael Neuling <mikey@neuling.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/ptrace.h
include/linux/sched.h
kernel/exit.c
kernel/ptrace.c

index 89573a33ab3c43ee84cf629d84e5ff3d7f091206..07d0df6bf7687064c0b328dbb316694faa7442cf 100644 (file)
@@ -142,9 +142,6 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
 {
        INIT_LIST_HEAD(&child->ptrace_entry);
        INIT_LIST_HEAD(&child->ptraced);
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
-       atomic_set(&child->ptrace_bp_refcnt, 1);
-#endif
        child->jobctl = 0;
        child->ptrace = 0;
        child->parent = child->real_parent;
@@ -351,11 +348,4 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
                                unsigned long args[6], unsigned int maxargs,
                                unsigned long *sp, unsigned long *pc);
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
-extern int ptrace_get_breakpoints(struct task_struct *tsk);
-extern void ptrace_put_breakpoints(struct task_struct *tsk);
-#else
-static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
-
 #endif
index 1100a5c60b892099cda85bceef2ca4470c35c377..8b10339321de08f92e5216274b70ecfe0e865e2e 100644 (file)
@@ -1404,9 +1404,6 @@ struct task_struct {
        } memcg_batch;
        unsigned int memcg_kmem_skip_account;
 #endif
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
-       atomic_t ptrace_bp_refcnt;
-#endif
 #ifdef CONFIG_UPROBES
        struct uprobe_task *utask;
 #endif
index 6a057750ebbbdee49b9c2c2b578567401fd8540f..2f3be8b6904b25513fe3946e11c3d8a1e824e74d 100644 (file)
@@ -819,7 +819,7 @@ void do_exit(long code)
        /*
         * FIXME: do that only when needed, using sched_exit tracepoint
         */
-       ptrace_put_breakpoints(tsk);
+       flush_ptrace_hw_breakpoint(tsk);
 
        exit_notify(tsk, group_dead);
 #ifdef CONFIG_NUMA
index aed981a3f69c180dda76bfca76411656842eec01..8cc170b157d73cbda10253014427b0393e0d47f6 100644 (file)
@@ -1179,19 +1179,3 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
        return ret;
 }
 #endif /* CONFIG_COMPAT */
-
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
-int ptrace_get_breakpoints(struct task_struct *tsk)
-{
-       if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt))
-               return 0;
-
-       return -1;
-}
-
-void ptrace_put_breakpoints(struct task_struct *tsk)
-{
-       if (atomic_dec_and_test(&tsk->ptrace_bp_refcnt))
-               flush_ptrace_hw_breakpoint(tsk);
-}
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */