aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tracehook.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tracehook.h')
-rw-r--r--include/linux/tracehook.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index a3e838784f43..7d38571b0c05 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -201,7 +201,7 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt,
201 struct linux_binprm *bprm, 201 struct linux_binprm *bprm,
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(PTRACE_EVENT_EXEC, 0) &&
205 unlikely(current->ptrace & PT_PTRACED)) 205 unlikely(current->ptrace & PT_PTRACED))
206 send_sig(SIGTRAP, current, 0); 206 send_sig(SIGTRAP, current, 0);
207} 207}
@@ -218,7 +218,7 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt,
218 */ 218 */
219static inline void tracehook_report_exit(long *exit_code) 219static inline void tracehook_report_exit(long *exit_code)
220{ 220{
221 ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code); 221 ptrace_event(PTRACE_EVENT_EXIT, *exit_code);
222} 222}
223 223
224/** 224/**
@@ -232,19 +232,19 @@ static inline void tracehook_report_exit(long *exit_code)
232 */ 232 */
233static inline int tracehook_prepare_clone(unsigned clone_flags) 233static inline int tracehook_prepare_clone(unsigned clone_flags)
234{ 234{
235 int event = 0;
236
235 if (clone_flags & CLONE_UNTRACED) 237 if (clone_flags & CLONE_UNTRACED)
236 return 0; 238 return 0;
237 239
238 if (clone_flags & CLONE_VFORK) { 240 if (clone_flags & CLONE_VFORK)
239 if (current->ptrace & PT_TRACE_VFORK) 241 event = PTRACE_EVENT_VFORK;
240 return PTRACE_EVENT_VFORK; 242 else if ((clone_flags & CSIGNAL) != SIGCHLD)
241 } else if ((clone_flags & CSIGNAL) != SIGCHLD) { 243 event = PTRACE_EVENT_CLONE;
242 if (current->ptrace & PT_TRACE_CLONE) 244 else
243 return PTRACE_EVENT_CLONE; 245 event = PTRACE_EVENT_FORK;
244 } else if (current->ptrace & PT_TRACE_FORK)
245 return PTRACE_EVENT_FORK;
246 246
247 return 0; 247 return ptrace_event_enabled(current, event) ? event : 0;
248} 248}
249 249
250/** 250/**
@@ -318,7 +318,7 @@ static inline void tracehook_report_clone_complete(int trace,
318 struct task_struct *child) 318 struct task_struct *child)
319{ 319{
320 if (unlikely(trace)) 320 if (unlikely(trace))
321 ptrace_event(0, trace, pid); 321 ptrace_event(trace, pid);
322} 322}
323 323
324/** 324/**
@@ -336,7 +336,7 @@ static inline void tracehook_report_clone_complete(int trace,
336static inline void tracehook_report_vfork_done(struct task_struct *child, 336static inline void tracehook_report_vfork_done(struct task_struct *child,
337 pid_t pid) 337 pid_t pid)
338{ 338{
339 ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid); 339 ptrace_event(PTRACE_EVENT_VFORK_DONE, pid);
340} 340}
341 341
342/** 342/**