Linux Kernel
3.7.1
|
#include <linux/compiler.h>
#include <linux/sched.h>
#include <linux/err.h>
#include <linux/bug.h>
#include <uapi/linux/ptrace.h>
Go to the source code of this file.
Functions | |
long | arch_ptrace (struct task_struct *child, long request, unsigned long addr, unsigned long data) |
int | ptrace_readdata (struct task_struct *tsk, unsigned long src, char __user *dst, int len) |
int | ptrace_writedata (struct task_struct *tsk, char __user *src, unsigned long dst, int len) |
void | ptrace_disable (struct task_struct *) |
int | ptrace_check_attach (struct task_struct *task, bool ignore_state) |
int | ptrace_request (struct task_struct *child, long request, unsigned long addr, unsigned long data) |
void | ptrace_notify (int exit_code) |
void | __ptrace_link (struct task_struct *child, struct task_struct *new_parent) |
void | __ptrace_unlink (struct task_struct *child) |
void | exit_ptrace (struct task_struct *tracer) |
bool | ptrace_may_access (struct task_struct *task, unsigned int mode) |
int | generic_ptrace_peekdata (struct task_struct *tsk, unsigned long addr, unsigned long data) |
int | generic_ptrace_pokedata (struct task_struct *tsk, unsigned long addr, unsigned long data) |
#define arch_has_block_step | ( | ) | (0) |
arch_has_block_step - does this CPU support user-mode block-step?
If this is defined, then there must be a function declaration or inline for user_enable_block_step(), and arch_has_single_step() must be defined too. arch_has_block_step() should evaluate to nonzero iff the machine supports step-until-branch for user mode. It can be a constant or it can test a CPU feature bit.
#define arch_has_single_step | ( | ) | (0) |
arch_has_single_step - does this CPU support user-mode single-step?
If this is defined, then there must be function declarations or inlines for user_enable_single_step() and user_disable_single_step(). arch_has_single_step() should evaluate to nonzero iff the machine supports instruction single-step for user mode. It can be a constant or it can test a CPU feature bit.
#define force_successful_syscall_return | ( | ) | do { } while (0) |
#define is_syscall_success | ( | regs | ) | (!IS_ERR_VALUE((unsigned long)(regs_return_value(regs)))) |
#define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT) |
#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ |
#define PT_EVENT_FLAG | ( | event | ) | (1 << (PT_OPT_FLAG_SHIFT + (event))) |
#define PT_PTRACE_CAP 0x00000004 /* ptracer can follow suid-exec */ |
#define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ |
#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) |
#define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) |
#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC) |
#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) |
#define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) |
#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP) |
#define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) |
#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) |
#define PT_TRACESYSGOOD PT_EVENT_FLAG(0) |
void __ptrace_link | ( | struct task_struct * | child, |
struct task_struct * | new_parent | ||
) |
void __ptrace_unlink | ( | struct task_struct * | child | ) |
__ptrace_unlink - unlink ptracee and restore its execution state : ptracee to be unlinked
Remove from the ptrace list, move it back to the original parent, and restore the execution state so that it conforms to the group stop state.
Unlinking can happen via two paths - explicit PTRACE_DETACH or ptracer exiting. For PTRACE_DETACH, unless the ptracee has been killed between ptrace_check_attach() and here, it's guaranteed to be in TASK_TRACED. If the ptracer is exiting, the ptracee can be in any state.
After detach, the ptracee should be in a state which conforms to the group stop. If the group is stopped or in the process of stopping, the ptracee should be put into TASK_STOPPED; otherwise, it should be woken up from TASK_TRACED.
If the ptracee is in TASK_TRACED and needs to be moved to TASK_STOPPED, it goes through TRACED -> RUNNING -> STOPPED transition which is similar to but in the opposite direction of what happens while attaching to a stopped task. However, in this direction, the intermediate RUNNING state is not hidden even from the current ptracer and if it immediately re-attaches and performs a WNOHANG wait(2), it may fail.
CONTEXT: write_lock_irq(tasklist_lock)
void exit_ptrace | ( | struct task_struct * | tracer | ) |
int generic_ptrace_peekdata | ( | struct task_struct * | tsk, |
unsigned long | addr, | ||
unsigned long | data | ||
) |
int generic_ptrace_pokedata | ( | struct task_struct * | tsk, |
unsigned long | addr, | ||
unsigned long | data | ||
) |
int ptrace_check_attach | ( | struct task_struct * | child, |
bool | ignore_state | ||
) |
ptrace_check_attach - check whether ptracee is ready for ptrace operation : ptracee to check for : don't check whether is currently TASK_TRACED
Check whether is being ptraced by current and ready for further ptrace operations. If is false, also should be in TASK_TRACED state and on return the child is guaranteed to be traced and not executing. If is true, can be in any state.
CONTEXT: Grabs and releases tasklist_lock and ->sighand->siglock.
RETURNS: 0 on success, -ESRCH if child is not ready.
void ptrace_disable | ( | struct task_struct * | ) |
bool ptrace_may_access | ( | struct task_struct * | task, |
unsigned int | mode | ||
) |