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.h41
1 files changed, 32 insertions, 9 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 17ba82efa483..10db0102a890 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Tracing hooks 2 * Tracing hooks
3 * 3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved. 4 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5 * 5 *
6 * This copyrighted material is made available to anyone wishing to use, 6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions 7 * modify, copy, or redistribute it subject to the terms and conditions
@@ -134,6 +134,13 @@ static inline __must_check int tracehook_report_syscall_entry(
134 */ 134 */
135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) 135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
136{ 136{
137 if (step) {
138 siginfo_t info;
139 user_single_step_siginfo(current, regs, &info);
140 force_sig_info(SIGTRAP, &info, current);
141 return;
142 }
143
137 ptrace_report_syscall(regs); 144 ptrace_report_syscall(regs);
138} 145}
139 146
@@ -463,22 +470,38 @@ static inline int tracehook_get_signal(struct task_struct *task,
463 470
464/** 471/**
465 * tracehook_notify_jctl - report about job control stop/continue 472 * tracehook_notify_jctl - report about job control stop/continue
466 * @notify: nonzero if this is the last thread in the group to stop 473 * @notify: zero, %CLD_STOPPED or %CLD_CONTINUED
467 * @why: %CLD_STOPPED or %CLD_CONTINUED 474 * @why: %CLD_STOPPED or %CLD_CONTINUED
468 * 475 *
469 * This is called when we might call do_notify_parent_cldstop(). 476 * This is called when we might call do_notify_parent_cldstop().
470 * It's called when about to stop for job control; we are already in
471 * %TASK_STOPPED state, about to call schedule(). It's also called when
472 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
473 * 477 *
474 * Return nonzero to generate a %SIGCHLD with @why, which is 478 * @notify is zero if we would not ordinarily send a %SIGCHLD,
475 * normal if @notify is nonzero. 479 * or is the %CLD_STOPPED or %CLD_CONTINUED .si_code for %SIGCHLD.
476 * 480 *
477 * Called with no locks held. 481 * @why is %CLD_STOPPED when about to stop for job control;
482 * we are already in %TASK_STOPPED state, about to call schedule().
483 * It might also be that we have just exited (check %PF_EXITING),
484 * but need to report that a group-wide stop is complete.
485 *
486 * @why is %CLD_CONTINUED when waking up after job control stop and
487 * ready to make a delayed @notify report.
488 *
489 * Return the %CLD_* value for %SIGCHLD, or zero to generate no signal.
490 *
491 * Called with the siglock held.
478 */ 492 */
479static inline int tracehook_notify_jctl(int notify, int why) 493static inline int tracehook_notify_jctl(int notify, int why)
480{ 494{
481 return notify || (current->ptrace & PT_PTRACED); 495 return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
496}
497
498/**
499 * tracehook_finish_jctl - report about return from job control stop
500 *
501 * This is called by do_signal_stop() after wakeup.
502 */
503static inline void tracehook_finish_jctl(void)
504{
482} 505}
483 506
484#define DEATH_REAP -1 507#define DEATH_REAP -1