FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/reg.h>
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/ptrace.h>
#include <sys/rwlock.h>
#include <sys/sx.h>
#include <sys/malloc.h>
#include <sys/signalvar.h>
#include <sys/caprights.h>
#include <sys/filedesc.h>
#include <security/audit/audit.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include <vm/vm_kern.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_param.h>
Go to the source code of this file.
Data Structures | |
struct | ptrace_args |
Macros | |
#define | PROC_ASSERT_TRACEREQ(p) MPASS(((p)->p_flag2 & P2_PTRACEREQ) != 0) |
#define | PROC_ACTION(action) |
#define | PROC_READ(w, t, a) proc_read_ ## w (t, a) |
#define | PROC_WRITE(w, t, a) proc_write_ ## w (t, a) |
Functions | |
__FBSDID ("$FreeBSD$") | |
int | proc_read_regs (struct thread *td, struct reg *regs) |
int | proc_write_regs (struct thread *td, struct reg *regs) |
int | proc_read_dbregs (struct thread *td, struct dbreg *dbregs) |
int | proc_write_dbregs (struct thread *td, struct dbreg *dbregs) |
int | proc_read_fpregs (struct thread *td, struct fpreg *fpregs) |
int | proc_write_fpregs (struct thread *td, struct fpreg *fpregs) |
static struct regset * | proc_find_regset (struct thread *td, int note) |
static int | proc_read_regset (struct thread *td, int note, struct iovec *iov) |
static int | proc_write_regset (struct thread *td, int note, struct iovec *iov) |
int | proc_sstep (struct thread *td) |
int | proc_rwmem (struct proc *p, struct uio *uio) |
static ssize_t | proc_iop (struct thread *td, struct proc *p, vm_offset_t va, void *buf, size_t len, enum uio_rw rw) |
ssize_t | proc_readmem (struct thread *td, struct proc *p, vm_offset_t va, void *buf, size_t len) |
ssize_t | proc_writemem (struct thread *td, struct proc *p, vm_offset_t va, void *buf, size_t len) |
static int | ptrace_vm_entry (struct thread *td, struct proc *p, struct ptrace_vm_entry *pve) |
int | sys_ptrace (struct thread *td, struct ptrace_args *uap) |
void | proc_set_traced (struct proc *p, bool stop) |
void | ptrace_unsuspend (struct proc *p) |
static int | proc_can_ptrace (struct thread *td, struct proc *p) |
static struct thread * | ptrace_sel_coredump_thread (struct proc *p) |
int | kern_ptrace (struct thread *td, int req, pid_t pid, void *addr, int data) |
#define PROC_ACTION | ( | action | ) |
Definition at line 102 of file sys_process.c.
#define PROC_ASSERT_TRACEREQ | ( | p | ) | MPASS(((p)->p_flag2 & P2_PTRACEREQ) != 0) |
Definition at line 74 of file sys_process.c.
#define PROC_READ | ( | w, | |
t, | |||
a | |||
) | proc_read_ ## w (t, a) |
Definition at line 729 of file sys_process.c.
#define PROC_WRITE | ( | w, | |
t, | |||
a | |||
) | proc_write_ ## w (t, a) |
Definition at line 730 of file sys_process.c.
__FBSDID | ( | "$FreeBSD$" | ) |
int kern_ptrace | ( | struct thread * | td, |
int | req, | ||
pid_t | pid, | ||
void * | addr, | ||
int | data | ||
) |
Definition at line 806 of file sys_process.c.
References addr, buf, cap_write_rights, data, fget_write(), free(), initproc, kern_psignal(), malloc(), p_candebug(), p_cansee(), pfind(), proc_can_ptrace(), PROC_READ, proc_read_regset(), proc_readmem(), proc_realparent(), proc_reparent(), proc_rwmem(), proc_set_traced(), proc_wkilled(), PROC_WRITE, proc_write_regset(), proc_writemem(), proctree_lock, ptrace_coredump(), ptrace_sel_coredump_thread(), ptrace_unsuspend(), ptrace_vm_entry(), sigqueue_delete(), sigqueue_take(), tdfind(), thread_run_flash(), thread_unsuspend(), and wakeup().
Referenced by sys_ptrace().
|
static |
Definition at line 759 of file sys_process.c.
References p_candebug(), and p_cansee().
Referenced by kern_ptrace().
|
static |
Definition at line 160 of file sys_process.c.
Referenced by proc_read_regset(), and proc_write_regset().
|
static |
Definition at line 418 of file sys_process.c.
References buf, and proc_rwmem().
Referenced by proc_readmem(), and proc_writemem().
int proc_read_dbregs | ( | struct thread * | td, |
struct dbreg * | dbregs | ||
) |
Definition at line 128 of file sys_process.c.
References PROC_ACTION.
int proc_read_fpregs | ( | struct thread * | td, |
struct fpreg * | fpregs | ||
) |
Definition at line 146 of file sys_process.c.
References PROC_ACTION.
int proc_read_regs | ( | struct thread * | td, |
struct reg * | regs | ||
) |
Definition at line 114 of file sys_process.c.
References PROC_ACTION.
|
static |
Definition at line 183 of file sys_process.c.
References buf, free(), malloc(), PROC_ASSERT_TRACEREQ, and proc_find_regset().
Referenced by kern_ptrace().
ssize_t proc_readmem | ( | struct thread * | td, |
struct proc * | p, | ||
vm_offset_t | va, | ||
void * | buf, | ||
size_t | len | ||
) |
Definition at line 444 of file sys_process.c.
References buf, and proc_iop().
Referenced by get_proc_vector(), kern_ptrace(), and proc_read_string().
int proc_rwmem | ( | struct proc * | p, |
struct uio * | uio | ||
) |
Definition at line 331 of file sys_process.c.
Referenced by kern_ptrace(), and proc_iop().
void proc_set_traced | ( | struct proc * | p, |
bool | stop | ||
) |
Definition at line 734 of file sys_process.c.
References proctree_lock, and stop.
Referenced by do_fork(), and kern_ptrace().
int proc_sstep | ( | struct thread * | td | ) |
Definition at line 324 of file sys_process.c.
References PROC_ACTION.
int proc_write_dbregs | ( | struct thread * | td, |
struct dbreg * | dbregs | ||
) |
Definition at line 135 of file sys_process.c.
References PROC_ACTION.
int proc_write_fpregs | ( | struct thread * | td, |
struct fpreg * | fpregs | ||
) |
Definition at line 153 of file sys_process.c.
References PROC_ACTION.
int proc_write_regs | ( | struct thread * | td, |
struct reg * | regs | ||
) |
Definition at line 121 of file sys_process.c.
References PROC_ACTION.
|
static |
Definition at line 238 of file sys_process.c.
References buf, free(), malloc(), PROC_ASSERT_TRACEREQ, and proc_find_regset().
Referenced by kern_ptrace().
ssize_t proc_writemem | ( | struct thread * | td, |
struct proc * | p, | ||
vm_offset_t | va, | ||
void * | buf, | ||
size_t | len | ||
) |
Definition at line 452 of file sys_process.c.
References buf, and proc_iop().
Referenced by kern_ptrace().
|
static |
Definition at line 791 of file sys_process.c.
Referenced by kern_ptrace().
void ptrace_unsuspend | ( | struct proc * | p | ) |
Definition at line 746 of file sys_process.c.
References itimer_proc_continue(), kqtimer_proc_continue(), and thread_unsuspend().
Referenced by exit1(), and kern_ptrace().
|
static |
Definition at line 460 of file sys_process.c.
References free(), vn_fullpath(), vput(), and vref().
Referenced by kern_ptrace(), and sys_ptrace().
int sys_ptrace | ( | struct thread * | td, |
struct ptrace_args * | uap | ||
) |
Definition at line 584 of file sys_process.c.
References addr, ptrace_args::addr, allow_ptrace, ptrace_args::data, kern_ptrace(), ptrace_args::pid, ptrace_coredump(), ptrace_vm_entry(), and ptrace_args::req.