diff options
author | Tejun Heo <tj@kernel.org> | 2011-06-17 10:50:34 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2011-06-22 13:26:27 -0400 |
commit | d21142ece414ce1088cfcae760689aa60d6fee80 (patch) | |
tree | 9f97b4518cd06fe695476fc6cc4ff9ed8d5bdd58 /include | |
parent | 544b2c91a9f14f9565af1972203438b7f49afd48 (diff) |
ptrace: kill task_ptrace()
task_ptrace(task) simply dereferences task->ptrace and isn't even used
consistently only adding confusion. Kill it and directly access
->ptrace instead.
This doesn't introduce any behavior change.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ptrace.h | 11 | ||||
-rw-r--r-- | include/linux/tracehook.h | 16 |
2 files changed, 8 insertions, 19 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 4f224f169524..3ff20b322598 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -146,17 +146,6 @@ int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, | |||
146 | unsigned long data); | 146 | unsigned long data); |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * task_ptrace - return %PT_* flags that apply to a task | ||
150 | * @task: pointer to &task_struct in question | ||
151 | * | ||
152 | * Returns the %PT_* flags that apply to @task. | ||
153 | */ | ||
154 | static inline int task_ptrace(struct task_struct *task) | ||
155 | { | ||
156 | return task->ptrace; | ||
157 | } | ||
158 | |||
159 | /** | ||
160 | * ptrace_event - possibly stop for a ptrace event notification | 149 | * ptrace_event - possibly stop for a ptrace event notification |
161 | * @mask: %PT_* bit to check in @current->ptrace | 150 | * @mask: %PT_* bit to check in @current->ptrace |
162 | * @event: %PTRACE_EVENT_* value to report if @mask is set | 151 | * @event: %PTRACE_EVENT_* value to report if @mask is set |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 15745cdd32ce..a3e838784f43 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -63,7 +63,7 @@ struct linux_binprm; | |||
63 | */ | 63 | */ |
64 | static inline int tracehook_expect_breakpoints(struct task_struct *task) | 64 | static inline int tracehook_expect_breakpoints(struct task_struct *task) |
65 | { | 65 | { |
66 | return (task_ptrace(task) & PT_PTRACED) != 0; | 66 | return (task->ptrace & PT_PTRACED) != 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | /* | 69 | /* |
@@ -71,7 +71,7 @@ static inline int tracehook_expect_breakpoints(struct task_struct *task) | |||
71 | */ | 71 | */ |
72 | static inline void ptrace_report_syscall(struct pt_regs *regs) | 72 | static inline void ptrace_report_syscall(struct pt_regs *regs) |
73 | { | 73 | { |
74 | int ptrace = task_ptrace(current); | 74 | int ptrace = current->ptrace; |
75 | 75 | ||
76 | if (!(ptrace & PT_PTRACED)) | 76 | if (!(ptrace & PT_PTRACED)) |
77 | return; | 77 | return; |
@@ -155,7 +155,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) | |||
155 | static inline int tracehook_unsafe_exec(struct task_struct *task) | 155 | static inline int tracehook_unsafe_exec(struct task_struct *task) |
156 | { | 156 | { |
157 | int unsafe = 0; | 157 | int unsafe = 0; |
158 | int ptrace = task_ptrace(task); | 158 | int ptrace = task->ptrace; |
159 | if (ptrace & PT_PTRACED) { | 159 | if (ptrace & PT_PTRACED) { |
160 | if (ptrace & PT_PTRACE_CAP) | 160 | if (ptrace & PT_PTRACE_CAP) |
161 | unsafe |= LSM_UNSAFE_PTRACE_CAP; | 161 | unsafe |= LSM_UNSAFE_PTRACE_CAP; |
@@ -178,7 +178,7 @@ static inline int tracehook_unsafe_exec(struct task_struct *task) | |||
178 | */ | 178 | */ |
179 | static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk) | 179 | static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk) |
180 | { | 180 | { |
181 | if (task_ptrace(tsk) & PT_PTRACED) | 181 | if (tsk->ptrace & PT_PTRACED) |
182 | return rcu_dereference(tsk->parent); | 182 | return rcu_dereference(tsk->parent); |
183 | return NULL; | 183 | return NULL; |
184 | } | 184 | } |
@@ -202,7 +202,7 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt, | |||
202 | struct pt_regs *regs) | 202 | struct pt_regs *regs) |
203 | { | 203 | { |
204 | if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) && | 204 | if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) && |
205 | unlikely(task_ptrace(current) & PT_PTRACED)) | 205 | unlikely(current->ptrace & PT_PTRACED)) |
206 | send_sig(SIGTRAP, current, 0); | 206 | send_sig(SIGTRAP, current, 0); |
207 | } | 207 | } |
208 | 208 | ||
@@ -285,7 +285,7 @@ static inline void tracehook_report_clone(struct pt_regs *regs, | |||
285 | unsigned long clone_flags, | 285 | unsigned long clone_flags, |
286 | pid_t pid, struct task_struct *child) | 286 | pid_t pid, struct task_struct *child) |
287 | { | 287 | { |
288 | if (unlikely(task_ptrace(child))) { | 288 | if (unlikely(child->ptrace)) { |
289 | /* | 289 | /* |
290 | * It doesn't matter who attached/attaching to this | 290 | * It doesn't matter who attached/attaching to this |
291 | * task, the pending SIGSTOP is right in any case. | 291 | * task, the pending SIGSTOP is right in any case. |
@@ -403,7 +403,7 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info, | |||
403 | static inline int tracehook_consider_ignored_signal(struct task_struct *task, | 403 | static inline int tracehook_consider_ignored_signal(struct task_struct *task, |
404 | int sig) | 404 | int sig) |
405 | { | 405 | { |
406 | return (task_ptrace(task) & PT_PTRACED) != 0; | 406 | return (task->ptrace & PT_PTRACED) != 0; |
407 | } | 407 | } |
408 | 408 | ||
409 | /** | 409 | /** |
@@ -422,7 +422,7 @@ static inline int tracehook_consider_ignored_signal(struct task_struct *task, | |||
422 | static inline int tracehook_consider_fatal_signal(struct task_struct *task, | 422 | static inline int tracehook_consider_fatal_signal(struct task_struct *task, |
423 | int sig) | 423 | int sig) |
424 | { | 424 | { |
425 | return (task_ptrace(task) & PT_PTRACED) != 0; | 425 | return (task->ptrace & PT_PTRACED) != 0; |
426 | } | 426 | } |
427 | 427 | ||
428 | #define DEATH_REAP -1 | 428 | #define DEATH_REAP -1 |