Lines Matching +full:current +full:- +full:mode
1 /* SPDX-License-Identifier: GPL-2.0 */
26 * The owner ship rules for task->ptrace which holds the ptrace
27 * flags is simple. When a task is running it owns it's task->ptrace
28 * flags. When the a task is stopped the ptracer owns task->ptrace.
75 * ptrace_may_access - check whether the caller is permitted to access
78 * @mode: selects type of access and caller credentials
83 * be set in @mode to specify whether the access was requested through
88 extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
92 return !same_thread_group(child->real_parent, child->parent); in ptrace_reparented()
97 if (unlikely(child->ptrace)) in ptrace_unlink()
107 * ptrace_parent - return the task that is tracing the given task
119 if (unlikely(task->ptrace)) in ptrace_parent()
120 return rcu_dereference(task->parent); in ptrace_parent()
125 * ptrace_event_enabled - test whether a ptrace event is enabled
135 return task->ptrace & PT_EVENT_FLAG(event); in ptrace_event_enabled()
139 * ptrace_event - possibly stop for a ptrace event notification
150 if (unlikely(ptrace_event_enabled(current, event))) { in ptrace_event()
151 current->ptrace_message = message; in ptrace_event()
155 if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) in ptrace_event()
156 send_sig(SIGTRAP, current, 0); in ptrace_event()
161 * ptrace_event_pid - possibly stop for a ptrace event notification
183 ns = task_active_pid_ns(rcu_dereference(current->parent)); in ptrace_event_pid()
192 * ptrace_init_task - initialize ptrace state for a new child
199 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
203 INIT_LIST_HEAD(&child->ptrace_entry); in ptrace_init_task()
204 INIT_LIST_HEAD(&child->ptraced); in ptrace_init_task()
205 child->jobctl = 0; in ptrace_init_task()
206 child->ptrace = 0; in ptrace_init_task()
207 child->parent = child->real_parent; in ptrace_init_task()
209 if (unlikely(ptrace) && current->ptrace) { in ptrace_init_task()
210 child->ptrace = current->ptrace; in ptrace_init_task()
211 __ptrace_link(child, current->parent, current->ptracer_cred); in ptrace_init_task()
213 if (child->ptrace & PT_SEIZED) in ptrace_init_task()
216 sigaddset(&child->pending.signal, SIGSTOP); in ptrace_init_task()
219 child->ptracer_cred = NULL; in ptrace_init_task()
223 * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped
230 BUG_ON(!list_empty(&task->ptraced)); in ptrace_release_task()
232 BUG_ON(!list_empty(&task->ptrace_entry)); in ptrace_release_task()
243 * is a no-op and the spurious error condition needs to be filtered out by some
244 * other means (e.g., in user-level, by passing an extra argument to the
262 * These do-nothing inlines are used when the arch does not
263 * implement single-step. The kerneldoc comments are here
269 * arch_has_single_step - does this CPU support user-mode single-step?
274 * supports instruction single-step for user mode.
280 * user_enable_single_step - single-step in user-mode task
281 * @task: either current or a task stopped in %TASK_TRACED
284 * Set @task so that when it returns to user mode, it will trap after the
294 * user_disable_single_step - cancel user-mode single-step
295 * @task: either current or a task stopped in %TASK_TRACED
312 * arch_has_block_step - does this CPU support user-mode block-step?
317 * supports step-until-branch for user mode. It can be a constant or it
323 * user_enable_block_step - step until branch in user-mode task
324 * @task: either current or a task stopped in %TASK_TRACED
327 * and will never be called when single-instruction stepping is being used.
328 * Set @task so that when it returns to user mode, it will trap after the
357 * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called
358 * @code: current->exit_code value ptrace will stop with
367 * if the thread has not been back to user mode since the last stop, the
371 * may include arch-specific operations necessary prior to a ptrace stop.
378 * arch_ptrace_stop - Do machine-specific work before stopping for ptrace
379 * @code: current->exit_code value ptrace will stop with
384 * access. The arch can have machine-specific work to be done before
394 #define current_pt_regs() task_pt_regs(current)
398 * unlike current_pt_regs(), this one is equal to task_pt_regs(current)
399 * on *all* architectures; the only reason to have a per-arch definition
403 #define signal_pt_regs() task_pt_regs(current)