FreeBSD kernel kern code
kern_procctl.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/capsicum.h>
#include <sys/lock.h>
#include <sys/mman.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/procctl.h>
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/wait.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_extern.h>
Include dependency graph for kern_procctl.c:

Go to the source code of this file.

Data Structures

struct  reap_kill_tracker
 
struct  procctl_cmd_info
 

Enumerations

enum  { PCTL_SLOCKED , PCTL_XLOCKED , PCTL_UNLOCKED }
 

Functions

 __FBSDID ("$FreeBSD$")
 
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, void *data)
 
static int reap_acquire (struct thread *td, struct proc *p, void *data __unused)
 
static int reap_release (struct thread *td, struct proc *p, void *data __unused)
 
static int reap_status (struct thread *td, struct proc *p, void *data)
 
static int reap_getpids (struct thread *td, struct proc *p, void *data)
 
static void reap_kill_proc (struct thread *td, struct proc *p2, ksiginfo_t *ksi, struct procctl_reaper_kill *rk, int *error)
 
 TAILQ_HEAD (reap_kill_tracker_head, reap_kill_tracker)
 
static void reap_kill_sched (struct reap_kill_tracker_head *tracker, struct proc *p2)
 
static int reap_kill (struct thread *td, struct proc *p, void *data)
 
static int trace_ctl (struct thread *td, struct proc *p, void *data)
 
static int trace_status (struct thread *td, struct proc *p, void *data)
 
static int trapcap_ctl (struct thread *td, struct proc *p, void *data)
 
static int trapcap_status (struct thread *td, struct proc *p, void *data)
 
static int no_new_privs_ctl (struct thread *td, struct proc *p, void *data)
 
static int no_new_privs_status (struct thread *td, struct proc *p, void *data)
 
static int protmax_ctl (struct thread *td, struct proc *p, void *data)
 
static int protmax_status (struct thread *td, struct proc *p, void *data)
 
static int aslr_ctl (struct thread *td, struct proc *p, void *data)
 
static int aslr_status (struct thread *td, struct proc *p, void *data)
 
static int stackgap_ctl (struct thread *td, struct proc *p, void *data)
 
static int stackgap_status (struct thread *td, struct proc *p, void *data)
 
static int wxmap_ctl (struct thread *td, struct proc *p, void *data)
 
static int wxmap_status (struct thread *td, struct proc *p, void *data)
 
static int pdeathsig_ctl (struct thread *td, struct proc *p, void *data)
 
static int pdeathsig_status (struct thread *td, struct proc *p, void *data)
 
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)
 

Variables

static const struct procctl_cmd_info procctl_cmds_info []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PCTL_SLOCKED 
PCTL_XLOCKED 
PCTL_UNLOCKED 

Definition at line 708 of file kern_procctl.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ aslr_ctl()

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

Definition at line 507 of file kern_procctl.c.

References data.

◆ aslr_status()

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

Definition at line 533 of file kern_procctl.c.

References data.

◆ kern_procctl()

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

Definition at line 911 of file kern_procctl.c.

References data, procctl_cmd_info::esrch_is_einval, kern_procctl_single(), procctl_cmd_info::lock_tree, procctl_cmd_info::need_candebug, procctl_cmd_info::one_proc, p_candebug(), p_cansee(), PCTL_SLOCKED, PCTL_XLOCKED, pfind(), pgfind(), procctl_cmds_info, and proctree_lock.

Referenced by sys_procctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_procctl_single()

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

Definition at line 903 of file kern_procctl.c.

References data, procctl_cmd_info::exec, and procctl_cmds_info.

Referenced by kern_procctl().

Here is the caller graph for this function:

◆ no_new_privs_ctl()

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

Definition at line 436 of file kern_procctl.c.

References data.

◆ no_new_privs_status()

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

Definition at line 450 of file kern_procctl.c.

References data.

◆ pdeathsig_ctl()

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

Definition at line 688 of file kern_procctl.c.

References data.

◆ pdeathsig_status()

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

Definition at line 700 of file kern_procctl.c.

References data.

◆ protect_set()

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

Definition at line 105 of file kern_procctl.c.

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

Here is the call graph for this function:

◆ protect_setchild()

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

Definition at line 53 of file kern_procctl.c.

References flags, and 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:

◆ protect_setchildren()

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

Definition at line 71 of file kern_procctl.c.

References flags, 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:

◆ protmax_ctl()

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

Definition at line 459 of file kern_procctl.c.

References data.

◆ protmax_status()

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

Definition at line 485 of file kern_procctl.c.

References data.

◆ reap_acquire()

static int reap_acquire ( struct thread *  td,
struct proc *  p,
void *data  __unused 
)
static

Definition at line 135 of file kern_procctl.c.

References proctree_lock.

◆ reap_getpids()

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

Definition at line 202 of file kern_procctl.c.

References data, free(), malloc(), proc_realparent(), and proctree_lock.

Here is the call graph for this function:

◆ reap_kill()

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

Definition at line 282 of file kern_procctl.c.

References data, free(), reap_kill_tracker::parent, proctree_lock, reap_kill_proc(), and reap_kill_sched().

Here is the call graph for this function:

◆ reap_kill_proc()

static void reap_kill_proc ( struct thread *  td,
struct proc *  p2,
ksiginfo_t *  ksi,
struct procctl_reaper_kill *  rk,
int *  error 
)
static

Definition at line 246 of file kern_procctl.c.

References p_cansignal(), and pksignal().

Referenced by reap_kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reap_kill_sched()

static void reap_kill_sched ( struct reap_kill_tracker_head *  tracker,
struct proc *  p2 
)
static

Definition at line 272 of file kern_procctl.c.

References malloc(), and reap_kill_tracker::parent.

Referenced by reap_kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reap_release()

static int reap_release ( struct thread *  td,
struct proc *  p,
void *data  __unused 
)
static

Definition at line 152 of file kern_procctl.c.

References initproc, proctree_lock, and reaper_abandon_children().

Here is the call graph for this function:

◆ reap_status()

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

Definition at line 167 of file kern_procctl.c.

References data, initproc, proc_realparent(), and proctree_lock.

Here is the call graph for this function:

◆ stackgap_ctl()

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

Definition at line 566 of file kern_procctl.c.

References data.

◆ stackgap_status()

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

Definition at line 606 of file kern_procctl.c.

References data.

◆ sys_procctl()

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

◆ TAILQ_HEAD()

TAILQ_HEAD ( reap_kill_tracker_head  ,
reap_kill_tracker   
)

◆ trace_ctl()

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

Definition at line 344 of file kern_procctl.c.

References data.

◆ trace_status()

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

Definition at line 386 of file kern_procctl.c.

References data.

◆ trapcap_ctl()

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

Definition at line 404 of file kern_procctl.c.

References data.

◆ trapcap_status()

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

Definition at line 425 of file kern_procctl.c.

References data.

◆ wxmap_ctl()

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

Definition at line 621 of file kern_procctl.c.

References data.

◆ wxmap_status()

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

Definition at line 659 of file kern_procctl.c.

References data.

Variable Documentation

◆ procctl_cmds_info

const struct procctl_cmd_info procctl_cmds_info[]
static

Definition at line 725 of file kern_procctl.c.

Referenced by kern_procctl(), kern_procctl_single(), and sys_procctl().