Subject: [merged] ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints.patch removed from -mm tree To: oleg@xxxxxxxxxx,benh@xxxxxxxxxxxxxxxxxxx,fweisbec@xxxxxxxxx,jan.kratochvil@xxxxxxxxxx,lethal@xxxxxxxxxxxx,linux@xxxxxxxxxxxxxxxx,mikey@xxxxxxxxxxx,mingo@xxxxxxxxxx,paulus@xxxxxxxxx,prasad@xxxxxxxxxxxxxxxxxx,will.deacon@xxxxxxx,mm-commits@xxxxxxxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Tue, 09 Jul 2013 16:21:11 -0700 The patch titled Subject: ptrace: revert "Prepare to fix racy accesses on task breakpoints" has been removed from the -mm tree. Its filename was ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Oleg Nesterov <oleg@xxxxxxxxxx> Subject: ptrace: revert "Prepare to fix racy accesses on task breakpoints" 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@xxxxxxxxxx> Acked-by: Frederic Weisbecker <fweisbec@xxxxxxxxx> Acked-by: Michael Neuling <mikey@xxxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Jan Kratochvil <jan.kratochvil@xxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Paul Mundt <lethal@xxxxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Prasad <prasad@xxxxxxxxxxxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/ptrace.h | 10 ---------- include/linux/sched.h | 3 --- kernel/exit.c | 2 +- kernel/ptrace.c | 16 ---------------- 4 files changed, 1 insertion(+), 30 deletions(-) diff -puN include/linux/ptrace.h~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints include/linux/ptrace.h --- a/include/linux/ptrace.h~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints +++ a/include/linux/ptrace.h @@ -142,9 +142,6 @@ static inline void ptrace_init_task(stru { 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 t 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 diff -puN include/linux/sched.h~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints include/linux/sched.h --- a/include/linux/sched.h~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints +++ a/include/linux/sched.h @@ -1401,9 +1401,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 diff -puN kernel/exit.c~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints kernel/exit.c --- a/kernel/exit.c~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints +++ a/kernel/exit.c @@ -808,7 +808,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 diff -puN kernel/ptrace.c~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints kernel/ptrace.c --- a/kernel/ptrace.c~ptrace-revert-prepare-to-fix-racy-accesses-on-task-breakpoints +++ a/kernel/ptrace.c @@ -1221,19 +1221,3 @@ asmlinkage long compat_sys_ptrace(compat 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 */ _ Patches currently in -mm which might be from oleg@xxxxxxxxxx are origin.patch linux-next.patch mm-mempolicy-fix-mbind_range-vma_adjust-interaction.patch include-linux-schedh-dont-use-task-pid-tgid-in-same_thread_group-has_group_leader_pid.patch lockdep-introduce-lock_acquire_exclusive-shared-helper-macros.patch lglock-update-lockdep-annotations-to-report-recursive-local-locks.patch fput-task_work_add-can-fail-if-the-caller-has-passed-exit_task_work-fix.patch fput-turn-list_head-delayed_fput_list-into-llist_head.patch llist-fix-simplify-llist_add-and-llist_add_batch.patch llist-llist_add-can-use-llist_add_batch.patch kernel-wide-fix-missing-validations-on-__get-__put-__copy_to-__copy_from_user.patch autofs4-allow-autofs-to-work-outside-the-initial-pid-namespace.patch autofs4-translate-pids-to-the-right-namespace-for-the-daemon.patch signals-eventpoll-set-saved_sigmask-at-the-start.patch move-exit_task_namespaces-outside-of-exit_notify-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html