FreeBSD kernel kern code
sys_process.c File Reference
#include <sys/cdefs.h>
#include "opt_compat.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/procctl.h>
#include <sys/vnode.h>
#include <sys/ptrace.h>
#include <sys/sx.h>
#include <sys/malloc.h>
#include <sys/signalvar.h>
#include <machine/reg.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_pager.h>
#include <vm/vm_param.h>
Include dependency graph for sys_process.c:

Go to the source code of this file.

Data Structures

struct  ptrace_args
 
struct  procctl_args
 

Macros

#define PROC_ACTION(action)
 
#define COPYIN(u, k, s)   copyin(u, k, s)
 
#define COPYOUT(k, u, s)   copyout(k, u, s)
 
#define PROC_READ(w, t, a)   proc_read_ ## w (t, a)
 
#define PROC_WRITE(w, t, a)   proc_write_ ## w (t, a)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
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)
 
int proc_sstep (struct thread *td)
 
int proc_rwmem (struct proc *p, struct uio *uio)
 
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)
 
int kern_ptrace (struct thread *td, int req, pid_t pid, void *addr, int data)
 
void stopevent (struct proc *p, unsigned int event, unsigned int val)
 
static int protect_setchild (struct thread *td, struct proc *p, int flags)
 
static int protect_setchildren (struct thread *td, struct proc *top, int flags)
 
static int protect_set (struct thread *td, struct proc *p, int flags)
 
int sys_procctl (struct thread *td, struct procctl_args *uap)
 
static int kern_procctl_single (struct thread *td, struct proc *p, int com, void *data)
 
int kern_procctl (struct thread *td, idtype_t idtype, id_t id, int com, void *data)
 

Macro Definition Documentation

#define COPYIN (   u,
  k,
 
)    copyin(u, k, s)

Definition at line 523 of file sys_process.c.

Referenced by sys_ptrace().

#define COPYOUT (   k,
  u,
 
)    copyout(k, u, s)

Definition at line 524 of file sys_process.c.

Referenced by sys_ptrace().

#define PROC_ACTION (   action)
Value:
do { \
int error; \
\
PROC_LOCK_ASSERT(td->td_proc, MA_OWNED); \
if ((td->td_proc->p_flag & P_INMEM) == 0) \
error = EIO; \
else \
error = (action); \
return (error); \
} while(0)

Definition at line 132 of file sys_process.c.

Referenced by proc_read_dbregs(), proc_read_fpregs(), proc_read_regs(), proc_sstep(), proc_write_dbregs(), proc_write_fpregs(), and proc_write_regs().

#define PROC_READ (   w,
  t,
 
)    proc_read_ ## w (t, a)

Definition at line 637 of file sys_process.c.

Referenced by kern_ptrace().

#define PROC_WRITE (   w,
  t,
 
)    proc_write_ ## w (t, a)

Definition at line 638 of file sys_process.c.

Referenced by kern_ptrace().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
int kern_procctl ( struct thread *  td,
idtype_t  idtype,
id_t  id,
int  com,
void *  data 
)

Definition at line 1460 of file sys_process.c.

References kern_procctl_single(), p_cansee(), pfind(), pgfind(), and proctree_lock.

Referenced by sys_procctl().

Here is the call graph for this function:

Here is the caller graph for this function:

static int kern_procctl_single ( struct thread *  td,
struct proc *  p,
int  com,
void *  data 
)
static

Definition at line 1447 of file sys_process.c.

References protect_set().

Referenced by kern_procctl().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_ptrace ( struct thread *  td,
int  req,
pid_t  pid,
void *  addr,
int  data 
)

Definition at line 642 of file sys_process.c.

References buf, count, free(), initproc, kern_psignal(), malloc(), p_candebug(), p_cansee(), pfind(), printf(), PROC_READ, proc_realparent(), proc_reparent(), proc_rwmem(), PROC_WRITE, proctree_lock, ptrace_vm_entry(), sigqueue_take(), tdfind(), and thread_unsuspend().

Referenced by sys_ptrace().

Here is the call graph for this function:

Here is the caller graph for this function:

int proc_read_dbregs ( struct thread *  td,
struct dbreg *  dbregs 
)

Definition at line 158 of file sys_process.c.

References PROC_ACTION.

int proc_read_fpregs ( struct thread *  td,
struct fpreg *  fpregs 
)

Definition at line 176 of file sys_process.c.

References PROC_ACTION.

int proc_read_regs ( struct thread *  td,
struct reg *  regs 
)

Definition at line 144 of file sys_process.c.

References PROC_ACTION.

int proc_rwmem ( struct proc *  p,
struct uio *  uio 
)

Definition at line 242 of file sys_process.c.

Referenced by kern_ptrace(), and proc_read_mem().

Here is the caller graph for this function:

int proc_sstep ( struct thread *  td)

Definition at line 235 of file sys_process.c.

References PROC_ACTION.

int proc_write_dbregs ( struct thread *  td,
struct dbreg *  dbregs 
)

Definition at line 165 of file sys_process.c.

References PROC_ACTION.

int proc_write_fpregs ( struct thread *  td,
struct fpreg *  fpregs 
)

Definition at line 183 of file sys_process.c.

References PROC_ACTION.

int proc_write_regs ( struct thread *  td,
struct reg *  regs 
)

Definition at line 151 of file sys_process.c.

References PROC_ACTION.

static int protect_set ( struct thread *  td,
struct proc *  p,
int  flags 
)
static

Definition at line 1389 of file sys_process.c.

References priv_check(), protect_setchild(), and protect_setchildren().

Referenced by kern_procctl_single().

Here is the call graph for this function:

Here is the caller graph for this function:

static int protect_setchild ( struct thread *  td,
struct proc *  p,
int  flags 
)
static

Definition at line 1337 of file sys_process.c.

References p_cansched().

Referenced by protect_set(), and protect_setchildren().

Here is the call graph for this function:

Here is the caller graph for this function:

static int protect_setchildren ( struct thread *  td,
struct proc *  top,
int  flags 
)
static

Definition at line 1355 of file sys_process.c.

References proctree_lock, and protect_setchild().

Referenced by protect_set().

Here is the call graph for this function:

Here is the caller graph for this function:

static int ptrace_vm_entry ( struct thread *  td,
struct proc *  p,
struct ptrace_vm_entry *  pve 
)
static

Definition at line 332 of file sys_process.c.

References free(), vn_fullpath(), vput(), and vref().

Referenced by kern_ptrace(), and sys_ptrace().

Here is the call graph for this function:

Here is the caller graph for this function:

void stopevent ( struct proc *  p,
unsigned int  event,
unsigned int  val 
)

Definition at line 1320 of file sys_process.c.

References wakeup().

Referenced by issignal(), and postsig().

Here is the call graph for this function:

Here is the caller graph for this function:

int sys_procctl ( struct thread *  td,
struct procctl_args uap 
)

Definition at line 1427 of file sys_process.c.

References procctl_args::com, procctl_args::data, procctl_args::id, procctl_args::idtype, and kern_procctl().

Here is the call graph for this function:

int sys_ptrace ( struct thread *  td,
struct ptrace_args uap 
)

Definition at line 527 of file sys_process.c.

References ptrace_args::addr, COPYIN, COPYOUT, ptrace_args::data, kern_ptrace(), ptrace_args::pid, ptrace_vm_entry(), and ptrace_args::req.

Here is the call graph for this function: