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()
154 if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) in ptrace_event()
155 send_sig(SIGTRAP, current, 0); in ptrace_event()
160 * ptrace_event_pid - possibly stop for a ptrace event notification
182 ns = task_active_pid_ns(rcu_dereference(current->parent)); in ptrace_event_pid()
191 * ptrace_init_task - initialize ptrace state for a new child
198 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
202 INIT_LIST_HEAD(&child->ptrace_entry); in ptrace_init_task()
203 INIT_LIST_HEAD(&child->ptraced); in ptrace_init_task()
204 child->jobctl = 0; in ptrace_init_task()
205 child->ptrace = 0; in ptrace_init_task()
206 child->parent = child->real_parent; in ptrace_init_task()
208 if (unlikely(ptrace) && current->ptrace) { in ptrace_init_task()
209 child->ptrace = current->ptrace; in ptrace_init_task()
210 __ptrace_link(child, current->parent, current->ptracer_cred); in ptrace_init_task()
212 if (child->ptrace & PT_SEIZED) in ptrace_init_task()
215 sigaddset(&child->pending.signal, SIGSTOP); in ptrace_init_task()
218 child->ptracer_cred = NULL; in ptrace_init_task()
222 * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped
229 BUG_ON(!list_empty(&task->ptraced)); in ptrace_release_task()
231 BUG_ON(!list_empty(&task->ptrace_entry)); in ptrace_release_task()
242 * is a no-op and the spurious error condition needs to be filtered out by some
243 * other means (e.g., in user-level, by passing an extra argument to the
261 * These do-nothing inlines are used when the arch does not
262 * implement single-step. The kerneldoc comments are here
268 * arch_has_single_step - does this CPU support user-mode single-step?
273 * supports instruction single-step for user mode.
279 * user_enable_single_step - single-step in user-mode task
280 * @task: either current or a task stopped in %TASK_TRACED
283 * Set @task so that when it returns to user mode, it will trap after the
293 * user_disable_single_step - cancel user-mode single-step
294 * @task: either current or a task stopped in %TASK_TRACED
311 * arch_has_block_step - does this CPU support user-mode block-step?
316 * supports step-until-branch for user mode. It can be a constant or it
322 * user_enable_block_step - step until branch in user-mode task
323 * @task: either current or a task stopped in %TASK_TRACED
326 * and will never be called when single-instruction stepping is being used.
327 * Set @task so that when it returns to user mode, it will trap after the
356 * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called
363 * superfluous. For example, if the thread has not been back to user mode
368 * may include arch-specific operations necessary prior to a ptrace stop.
375 * arch_ptrace_stop - Do machine-specific work before stopping for ptrace
379 * access. The arch can have machine-specific work to be done before
389 #define current_pt_regs() task_pt_regs(current)
393 * unlike current_pt_regs(), this one is equal to task_pt_regs(current)
394 * on *all* architectures; the only reason to have a per-arch definition
398 #define signal_pt_regs() task_pt_regs(current)
414 int ptrace = current->ptrace; in ptrace_report_syscall()
426 * stopping signal is not SIGTRAP. -brl in ptrace_report_syscall()
429 send_sig(signr, current, 1); in ptrace_report_syscall()
431 return fatal_signal_pending(current); in ptrace_report_syscall()
435 * ptrace_report_syscall_entry - task is about to attempt a system call
436 * @regs: user register state of current task
439 * %SYSCALL_WORK_SYSCALL_EMU have been set, when the current task has just
447 * made. If @task ever returns to user mode after this, its register state
450 * can work (see asm-generic/syscall.h).
452 * Called without locks, just after entering kernel mode.
461 * ptrace_report_syscall_exit - task has just finished a system call
462 * @regs: user register state of current task
463 * @step: nonzero if simulating single-step or block-step
466 * the current task has just finished an attempted system call. Full