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, 10 insertions, 16 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6186a789d6c7..eb96603d92db 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -259,14 +259,12 @@ static inline void tracehook_finish_clone(struct task_struct *child,
259 259
260/** 260/**
261 * tracehook_report_clone - in parent, new child is about to start running 261 * tracehook_report_clone - in parent, new child is about to start running
262 * @trace: return value from tracehook_prepare_clone()
263 * @regs: parent's user register state 262 * @regs: parent's user register state
264 * @clone_flags: flags from parent's system call 263 * @clone_flags: flags from parent's system call
265 * @pid: new child's PID in the parent's namespace 264 * @pid: new child's PID in the parent's namespace
266 * @child: new child task 265 * @child: new child task
267 * 266 *
268 * Called after a child is set up, but before it has been started 267 * Called after a child is set up, but before it has been started running.
269 * running. @trace is the value returned by tracehook_prepare_clone().
270 * This is not a good place to block, because the child has not started 268 * This is not a good place to block, because the child has not started
271 * yet. Suspend the child here if desired, and then block in 269 * yet. Suspend the child here if desired, and then block in
272 * tracehook_report_clone_complete(). This must prevent the child from 270 * tracehook_report_clone_complete(). This must prevent the child from
@@ -276,13 +274,14 @@ static inline void tracehook_finish_clone(struct task_struct *child,
276 * 274 *
277 * Called with no locks held, but the child cannot run until this returns. 275 * Called with no locks held, but the child cannot run until this returns.
278 */ 276 */
279static inline void tracehook_report_clone(int trace, struct pt_regs *regs, 277static inline void tracehook_report_clone(struct pt_regs *regs,
280 unsigned long clone_flags, 278 unsigned long clone_flags,
281 pid_t pid, struct task_struct *child) 279 pid_t pid, struct task_struct *child)
282{ 280{
283 if (unlikely(trace) || unlikely(clone_flags & CLONE_PTRACE)) { 281 if (unlikely(task_ptrace(child))) {
284 /* 282 /*
285 * The child starts up with an immediate SIGSTOP. 283 * It doesn't matter who attached/attaching to this
284 * task, the pending SIGSTOP is right in any case.
286 */ 285 */
287 sigaddset(&child->pending.signal, SIGSTOP); 286 sigaddset(&child->pending.signal, SIGSTOP);
288 set_tsk_thread_flag(child, TIF_SIGPENDING); 287 set_tsk_thread_flag(child, TIF_SIGPENDING);
@@ -388,17 +387,14 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal 387 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
389 * @task: task receiving the signal 388 * @task: task receiving the signal
390 * @sig: signal number being sent 389 * @sig: signal number being sent
391 * @handler: %SIG_IGN or %SIG_DFL
392 * 390 *
393 * Return zero iff tracing doesn't care to examine this ignored signal, 391 * Return zero iff tracing doesn't care to examine this ignored signal,
394 * so it can short-circuit normal delivery and never even get queued. 392 * so it can short-circuit normal delivery and never even get queued.
395 * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN.
396 * 393 *
397 * Called with @task->sighand->siglock held. 394 * Called with @task->sighand->siglock held.
398 */ 395 */
399static inline int tracehook_consider_ignored_signal(struct task_struct *task, 396static inline int tracehook_consider_ignored_signal(struct task_struct *task,
400 int sig, 397 int sig)
401 void __user *handler)
402{ 398{
403 return (task_ptrace(task) & PT_PTRACED) != 0; 399 return (task_ptrace(task) & PT_PTRACED) != 0;
404} 400}
@@ -407,19 +403,17 @@ static inline int tracehook_consider_ignored_signal(struct task_struct *task,
407 * tracehook_consider_fatal_signal - suppress special handling of fatal signal 403 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
408 * @task: task receiving the signal 404 * @task: task receiving the signal
409 * @sig: signal number being sent 405 * @sig: signal number being sent
410 * @handler: %SIG_DFL or %SIG_IGN
411 * 406 *
412 * Return nonzero to prevent special handling of this termination signal. 407 * Return nonzero to prevent special handling of this termination signal.
413 * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored, 408 * Normally handler for signal is %SIG_DFL. It can be %SIG_IGN if @sig is
414 * in which case force_sig() is about to reset it to %SIG_DFL. 409 * ignored, in which case force_sig() is about to reset it to %SIG_DFL.
415 * When this returns zero, this signal might cause a quick termination 410 * When this returns zero, this signal might cause a quick termination
416 * that does not give the debugger a chance to intercept the signal. 411 * that does not give the debugger a chance to intercept the signal.
417 * 412 *
418 * Called with or without @task->sighand->siglock held. 413 * Called with or without @task->sighand->siglock held.
419 */ 414 */
420static inline int tracehook_consider_fatal_signal(struct task_struct *task, 415static inline int tracehook_consider_fatal_signal(struct task_struct *task,
421 int sig, 416 int sig)
422 void __user *handler)
423{ 417{
424 return (task_ptrace(task) & PT_PTRACED) != 0; 418 return (task_ptrace(task) & PT_PTRACED) != 0;
425} 419}
@@ -507,7 +501,7 @@ static inline int tracehook_notify_jctl(int notify, int why)
507static inline int tracehook_notify_death(struct task_struct *task, 501static inline int tracehook_notify_death(struct task_struct *task,
508 void **death_cookie, int group_dead) 502 void **death_cookie, int group_dead)
509{ 503{
510 if (task->exit_signal == -1) 504 if (task_detached(task))
511 return task->ptrace ? SIGCHLD : DEATH_REAP; 505 return task->ptrace ? SIGCHLD : DEATH_REAP;
512 506
513 /* 507 /*