int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr,
unsigned long data);
-/**
- * task_ptrace - return %PT_* flags that apply to a task
- * @task: pointer to &task_struct in question
- *
- * Returns the %PT_* flags that apply to @task.
- */
-static inline int task_ptrace(struct task_struct *task)
-{
- return task->ptrace;
-}
-
/**
* ptrace_event - possibly stop for a ptrace event notification
* @mask: %PT_* bit to check in @current->ptrace
*/
static inline int tracehook_expect_breakpoints(struct task_struct *task)
{
- return (task_ptrace(task) & PT_PTRACED) != 0;
+ return (task->ptrace & PT_PTRACED) != 0;
}
/*
*/
static inline void ptrace_report_syscall(struct pt_regs *regs)
{
- int ptrace = task_ptrace(current);
+ int ptrace = current->ptrace;
if (!(ptrace & PT_PTRACED))
return;
static inline int tracehook_unsafe_exec(struct task_struct *task)
{
int unsafe = 0;
- int ptrace = task_ptrace(task);
+ int ptrace = task->ptrace;
if (ptrace & PT_PTRACED) {
if (ptrace & PT_PTRACE_CAP)
unsafe |= LSM_UNSAFE_PTRACE_CAP;
*/
static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk)
{
- if (task_ptrace(tsk) & PT_PTRACED)
+ if (tsk->ptrace & PT_PTRACED)
return rcu_dereference(tsk->parent);
return NULL;
}
struct pt_regs *regs)
{
if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
- unlikely(task_ptrace(current) & PT_PTRACED))
+ unlikely(current->ptrace & PT_PTRACED))
send_sig(SIGTRAP, current, 0);
}
unsigned long clone_flags,
pid_t pid, struct task_struct *child)
{
- if (unlikely(task_ptrace(child))) {
+ if (unlikely(child->ptrace)) {
/*
* It doesn't matter who attached/attaching to this
* task, the pending SIGSTOP is right in any case.
static inline int tracehook_consider_ignored_signal(struct task_struct *task,
int sig)
{
- return (task_ptrace(task) & PT_PTRACED) != 0;
+ return (task->ptrace & PT_PTRACED) != 0;
}
/**
static inline int tracehook_consider_fatal_signal(struct task_struct *task,
int sig)
{
- return (task_ptrace(task) & PT_PTRACED) != 0;
+ return (task->ptrace & PT_PTRACED) != 0;
}
#define DEATH_REAP -1
p->exit_signal = SIGCHLD;
/* If it has exited notify the new parent about this child's death. */
- if (!task_ptrace(p) &&
+ if (!p->ptrace &&
p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {
do_notify_parent(p, p->exit_signal);
if (task_detached(p)) {
do {
t->real_parent = reaper;
if (t->parent == father) {
- BUG_ON(task_ptrace(t));
+ BUG_ON(t->ptrace);
t->parent = t->real_parent;
}
if (t->pdeath_signal)
* Notification and reaping will be cascaded to the real
* parent when the ptracer detaches.
*/
- if (likely(!ptrace) && unlikely(task_ptrace(p))) {
+ if (likely(!ptrace) && unlikely(p->ptrace)) {
/* it will become visible, clear notask_error */
wo->notask_error = 0;
return 0;
* own children, it should create a separate process which
* takes the role of real parent.
*/
- if (likely(!ptrace) && task_ptrace(p) &&
+ if (likely(!ptrace) && p->ptrace &&
same_thread_group(p->parent, p->real_parent))
return 0;
/* do_notify_parent_cldstop should have been called instead. */
BUG_ON(task_is_stopped_or_traced(tsk));
- BUG_ON(!task_ptrace(tsk) &&
+ BUG_ON(!tsk->ptrace &&
(tsk->group_leader != tsk || !thread_group_empty(tsk)));
info.si_signo = sig;
psig = tsk->parent->sighand;
spin_lock_irqsave(&psig->siglock, flags);
- if (!task_ptrace(tsk) && sig == SIGCHLD &&
+ if (!tsk->ptrace && sig == SIGCHLD &&
(psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN ||
(psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT))) {
/*
static inline int may_ptrace_stop(void)
{
- if (!likely(task_ptrace(current)))
+ if (!likely(current->ptrace))
return 0;
/*
* Are we in the middle of do_coredump?
if (!(sig->flags & SIGNAL_STOP_STOPPED))
sig->group_exit_code = signr;
else
- WARN_ON_ONCE(!task_ptrace(current));
+ WARN_ON_ONCE(!current->ptrace);
sig->group_stop_count = 0;
}
}
- if (likely(!task_ptrace(current))) {
+ if (likely(!current->ptrace)) {
int notify = 0;
/*
static int ptrace_signal(int signr, siginfo_t *info,
struct pt_regs *regs, void *cookie)
{
- if (!task_ptrace(current))
+ if (!current->ptrace)
return signr;
ptrace_signal_deliver(regs, cookie);
do_notify_parent_cldstop(current, false, why);
leader = current->group_leader;
- if (task_ptrace(leader) && !real_parent_is_ptracer(leader))
+ if (leader->ptrace && !real_parent_is_ptracer(leader))
do_notify_parent_cldstop(leader, true, why);
read_unlock(&tasklist_lock);
* then wait for it to finish before killing
* some other task unnecessarily.
*/
- if (!(task_ptrace(p->group_leader) &
- PT_TRACE_EXIT))
+ if (!(p->group_leader->ptrace & PT_TRACE_EXIT))
return ERR_PTR(-1UL);
}
}