Commit 0f4814065ff8c24ca8bfd75c9b73502be152c287
Committed by
Ingo Molnar
1 parent
ee811517a5
Exists in
master
and in
4 other branches
x86, ptrace: add bts context unconditionally
Add the ptrace bts context field to task_struct unconditionally. Initialize the field directly in copy_process(). Remove all the unneeded functionality used to initialize that field. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> Cc: roland@redhat.com Cc: eranian@googlemail.com Cc: oleg@redhat.com Cc: juan.villacis@intel.com Cc: ak@linux.jf.intel.com LKML-Reference: <20090403144603.292754000@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 6 changed files with 7 additions and 48 deletions Side-by-side Diff
arch/x86/include/asm/ptrace.h
... | ... | @@ -235,12 +235,11 @@ |
235 | 235 | extern int do_set_thread_area(struct task_struct *p, int idx, |
236 | 236 | struct user_desc __user *info, int can_allocate); |
237 | 237 | |
238 | -extern void x86_ptrace_untrace(struct task_struct *); | |
239 | -extern void x86_ptrace_fork(struct task_struct *child, | |
240 | - unsigned long clone_flags); | |
238 | +#ifdef CONFIG_X86_PTRACE_BTS | |
239 | +extern void ptrace_bts_untrace(struct task_struct *tsk); | |
241 | 240 | |
242 | -#define arch_ptrace_untrace(tsk) x86_ptrace_untrace(tsk) | |
243 | -#define arch_ptrace_fork(child, flags) x86_ptrace_fork(child, flags) | |
241 | +#define arch_ptrace_untrace(tsk) ptrace_bts_untrace(tsk) | |
242 | +#endif /* CONFIG_X86_PTRACE_BTS */ | |
244 | 243 | |
245 | 244 | #endif /* __KERNEL__ */ |
246 | 245 |
arch/x86/kernel/ptrace.c
... | ... | @@ -887,36 +887,18 @@ |
887 | 887 | return (trace->ds.top - trace->ds.begin) / trace->ds.size; |
888 | 888 | } |
889 | 889 | |
890 | -static inline void ptrace_bts_fork(struct task_struct *tsk) | |
891 | -{ | |
892 | - tsk->bts = NULL; | |
893 | -} | |
894 | - | |
895 | 890 | /* |
896 | 891 | * Called from __ptrace_unlink() after the child has been moved back |
897 | 892 | * to its original parent. |
898 | 893 | */ |
899 | -static inline void ptrace_bts_untrace(struct task_struct *child) | |
894 | +void ptrace_bts_untrace(struct task_struct *child) | |
900 | 895 | { |
901 | 896 | if (unlikely(child->bts)) { |
902 | 897 | free_bts_context(child->bts); |
903 | 898 | child->bts = NULL; |
904 | 899 | } |
905 | 900 | } |
906 | -#else | |
907 | -static inline void ptrace_bts_fork(struct task_struct *tsk) {} | |
908 | -static inline void ptrace_bts_untrace(struct task_struct *child) {} | |
909 | 901 | #endif /* CONFIG_X86_PTRACE_BTS */ |
910 | - | |
911 | -void x86_ptrace_fork(struct task_struct *child, unsigned long clone_flags) | |
912 | -{ | |
913 | - ptrace_bts_fork(child); | |
914 | -} | |
915 | - | |
916 | -void x86_ptrace_untrace(struct task_struct *child) | |
917 | -{ | |
918 | - ptrace_bts_untrace(child); | |
919 | -} | |
920 | 902 | |
921 | 903 | /* |
922 | 904 | * Called by kernel/ptrace.c when detaching.. |
include/linux/ptrace.h
... | ... | @@ -95,7 +95,6 @@ |
95 | 95 | struct task_struct *new_parent); |
96 | 96 | extern void __ptrace_unlink(struct task_struct *child); |
97 | 97 | extern void exit_ptrace(struct task_struct *tracer); |
98 | -extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags); | |
99 | 98 | #define PTRACE_MODE_READ 1 |
100 | 99 | #define PTRACE_MODE_ATTACH 2 |
101 | 100 | /* Returns 0 on success, -errno on denial. */ |
... | ... | @@ -325,15 +324,6 @@ |
325 | 324 | * Called with write_lock(&tasklist_lock) held. |
326 | 325 | */ |
327 | 326 | #define arch_ptrace_untrace(task) do { } while (0) |
328 | -#endif | |
329 | - | |
330 | -#ifndef arch_ptrace_fork | |
331 | -/* | |
332 | - * Do machine-specific work to initialize a new task. | |
333 | - * | |
334 | - * This is called from copy_process(). | |
335 | - */ | |
336 | -#define arch_ptrace_fork(child, clone_flags) do { } while (0) | |
337 | 327 | #endif |
338 | 328 | |
339 | 329 | extern int task_current_syscall(struct task_struct *target, long *callno, |
include/linux/sched.h
... | ... | @@ -1205,13 +1205,11 @@ |
1205 | 1205 | struct list_head ptraced; |
1206 | 1206 | struct list_head ptrace_entry; |
1207 | 1207 | |
1208 | -#ifdef CONFIG_X86_PTRACE_BTS | |
1209 | 1208 | /* |
1210 | 1209 | * This is the tracer handle for the ptrace BTS extension. |
1211 | 1210 | * This field actually belongs to the ptracer task. |
1212 | 1211 | */ |
1213 | 1212 | struct bts_context *bts; |
1214 | -#endif /* CONFIG_X86_PTRACE_BTS */ | |
1215 | 1213 | |
1216 | 1214 | /* PID/PID hash table linkage. */ |
1217 | 1215 | struct pid_link pids[PIDTYPE_MAX]; |
kernel/fork.c
... | ... | @@ -1086,8 +1086,8 @@ |
1086 | 1086 | #ifdef CONFIG_DEBUG_MUTEXES |
1087 | 1087 | p->blocked_on = NULL; /* not blocked yet */ |
1088 | 1088 | #endif |
1089 | - if (unlikely(current->ptrace)) | |
1090 | - ptrace_fork(p, clone_flags); | |
1089 | + | |
1090 | + p->bts = NULL; | |
1091 | 1091 | |
1092 | 1092 | /* Perform scheduler related setup. Assign this task to a CPU. */ |
1093 | 1093 | sched_fork(p, clone_flags); |
kernel/ptrace.c
... | ... | @@ -27,16 +27,6 @@ |
27 | 27 | |
28 | 28 | |
29 | 29 | /* |
30 | - * Initialize a new task whose father had been ptraced. | |
31 | - * | |
32 | - * Called from copy_process(). | |
33 | - */ | |
34 | -void ptrace_fork(struct task_struct *child, unsigned long clone_flags) | |
35 | -{ | |
36 | - arch_ptrace_fork(child, clone_flags); | |
37 | -} | |
38 | - | |
39 | -/* | |
40 | 30 | * ptrace a task: make the debugger its new parent and |
41 | 31 | * move it to the ptrace list. |
42 | 32 | * |