History

ptrace: revert "Prepare to fix racy accesses on task breakpoints"

This reverts commit bf26c018490c ("Prepare to fix racy accesses on task breakpoints"). The patch was fine but we can no longer race with SIGKILL after commit 9899d11f6544 ("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.

Oleg Nesterov committed 13 years ago

Commit 7c8df281 parent e8c073c4 files · +1 −30Browse files

Unified · Split

4 files
  1. include/linux/ptrace.h +0 −10
  2. include/linux/sched.h +0 −3
  3. kernel/exit.c +1 −1
  4. kernel/ptrace.c +0 −16
include/linux/ptrace.h+0−10
@@ -142,9 +142,6 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace) · 141 unmodified lines
142142 {
143143 INIT_LIST_HEAD(&child->ptrace_entry);
144144 INIT_LIST_HEAD(&child->ptraced);
145−#ifdef CONFIG_HAVE_HW_BREAKPOINT
146− atomic_set(&child->ptrace_bp_refcnt, 1);
147−#endif
148145 child->jobctl = 0;
149146 child->ptrace = 0;
150147 child->parent = child->real_parent;
@@ -351,11 +348,4 @@ extern int task_current_syscall(struct task_struct *target, long *callno, · 200 unmodified lines
351348 unsigned long args[6], unsigned int maxargs,
352349 unsigned long *sp, unsigned long *pc);
353350
354−#ifdef CONFIG_HAVE_HW_BREAKPOINT
355−extern int ptrace_get_breakpoints(struct task_struct *tsk);
356−extern void ptrace_put_breakpoints(struct task_struct *tsk);
357−#else
358−static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
359−#endif /* CONFIG_HAVE_HW_BREAKPOINT */
360−
361351 #endif
include/linux/sched.h+0−3
@@ -1401,9 +1401,6 @@ struct task_struct { · 1400 unmodified lines
14011401 } memcg_batch;
14021402 unsigned int memcg_kmem_skip_account;
14031403 #endif
1404−#ifdef CONFIG_HAVE_HW_BREAKPOINT
1405− atomic_t ptrace_bp_refcnt;
1406−#endif
14071404 #ifdef CONFIG_UPROBES
14081405 struct uprobe_task *utask;
14091406 #endif
kernel/exit.c+1−1
@@ -808,7 +808,7 @@ void do_exit(long code) · 807 unmodified lines
808808 /*
809809 * FIXME: do that only when needed, using sched_exit tracepoint
810810 */
811− ptrace_put_breakpoints(tsk);
811+ flush_ptrace_hw_breakpoint(tsk);
812812
813813 exit_notify(tsk, group_dead);
814814 #ifdef CONFIG_NUMA
kernel/ptrace.c+0−16
@@ -1221,19 +1221,3 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, · 1220 unmodified lines
12211221 return ret;
12221222 }
12231223 #endif /* CONFIG_COMPAT */
1224−
1225−#ifdef CONFIG_HAVE_HW_BREAKPOINT
1226−int ptrace_get_breakpoints(struct task_struct *tsk)
1227−{
1228− if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt))
1229− return 0;
1230−
1231− return -1;
1232−}
1233−
1234−void ptrace_put_breakpoints(struct task_struct *tsk)
1235−{
1236− if (atomic_dec_and_test(&tsk->ptrace_bp_refcnt))
1237− flush_ptrace_hw_breakpoint(tsk);
1238−}
1239−#endif /* CONFIG_HAVE_HW_BREAKPOINT */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t