Print this page
Code review comments from jeffpc
7029 want per-process exploit mitigation features (secflags)
7030 want basic address space layout randomization (aslr)
7031 noexec_user_stack should be a secflag
7032 want a means to forbid mappings around NULL.
   1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2015 Joyent, Inc.
  13 .\"
  14 .Dd May 08, 2016
  15 .Dt LIBPROC 3LIB
  16 .Os
  17 .Sh NAME
  18 .Nm libproc
  19 .Nd process control library
  20 .Sh SYNOPSIS
  21 .Lb libproc
  22 .In libproc.h
  23 .Sh DESCRIPTION
  24 The
  25 .Nm
  26 library provides consumers a general series of interfaces to inspect
  27 and control both live processes and core files. It is intended for
  28 introspection tools such as debuggers by providing a high-level
  29 interface to the /proc file system
  30 .Pf ( Xr proc 4 ) .
  31 .Pp
  32 The
  33 .Nm
  34 library provides interfaces that focus on:


 206 .It Sy Pdstop Ta Sy Pexecname
 207 .It Sy Pfault Ta Sy Pfgcore
 208 .It Sy Pgcore Ta Sy Pgetareg
 209 .It Sy Pgetauxval Ta Sy Pgetauxvec
 210 .It Sy Pgetenv Ta Sy Pisprocdir
 211 .It Sy Pissyscall_prev Ta Sy Plmid
 212 .It Sy Plmid_to_loadobj Ta Sy Plmid_to_map
 213 .It Sy Plookup_by_addr Ta Sy Plookup_by_name
 214 .It Sy Plwp_alt_stack Ta Sy Plwp_getfpregs
 215 .It Sy Plwp_getpsinfo Ta Sy Plwp_getregs
 216 .It Sy Plwp_getspymaster Ta Sy Plwp_main_stack
 217 .It Sy Plwp_setfpregs Ta Sy Plwp_setregs
 218 .It Sy Plwp_stack Ta Sy Pname_to_ctf
 219 .It Sy Pname_to_loadobj Ta Sy Pname_to_map
 220 .It Sy Pobjname Ta Sy Pobjname_resolved
 221 .It Sy Pplatform Ta Sy Ppltdest
 222 .It Sy Ppriv Ta Sy Ppsinfo
 223 .It Sy Pputareg Ta Sy Prd_agent
 224 .It Sy Pread Ta Sy Pread_string
 225 .It Sy Preset_maps Ta Sy Psetbkpt
 226 .It Sy Psetcred Ta Sy Psetfault
 227 .It Sy Psetflags Ta Sy Psetpriv
 228 .It Sy Psetrun Ta Sy Psetsignal
 229 .It Sy Psetsysentry Ta Sy Psetsysexit
 230 .It Sy Psetwapt Ta Sy Psetzoneid
 231 .It Sy Psignal Ta Sy Pstate
 232 .It Sy Pstatus Ta Sy Pstop
 233 .It Sy Pstopstatus Ta Sy Psync
 234 .It Sy Psysentry Ta Sy Psysexit
 235 .It Sy Puname Ta Sy Punsetflags
 236 .It Sy Pupdate_maps Ta Sy Pupdate_syms
 237 .It Sy Pwait Ta Sy Pwrite
 238 .It Sy Pxecbkpt Ta Sy Pxecwapt
 239 .It Sy Pxlookup_by_addr Ta Sy Pxlookup_by_addr_resolved
 240 .It Sy Pxlookup_by_name Ta Sy Pzonename
 241 .It Sy Pzonepath Ta Sy Pzoneroot

 242 .El
 243 .Ss Thread interrogation and manipulation
 244 The following routines obtain information about a thread and allow
 245 manipulation of the thread itself.
 246 .Bl -column -offset indent ".Sy Pmapping_iter_resolved" ".Sy Psymbol_iter_by_addr"
 247 .It Sy Lalt_stack Ta Sy Lclearfault
 248 .It Sy Lclearsig Ta Sy Lctlfd
 249 .It Sy Ldstop Ta Sy Lgetareg
 250 .It Sy Lmain_stack Ta Sy Lprochandle
 251 .It Sy Lpsinfo Ta Sy Lputareg
 252 .It Sy Lsetrun Ta Sy Lstack
 253 .It Sy Lstate Ta Sy Lstatus
 254 .It Sy Lstop Ta Sy Lsync
 255 .It Sy Lwait Ta Sy Lxecbkpt
 256 .It Sy Lxecwapt Ta ""
 257 .El
 258 .Ss System Call Injection
 259 The following routines are used to inject specific system calls and have
 260 them run in the context of a process.
 261 .Bl -column -offset indent ".Sy Pmapping_iter_resolved" ".Sy Psymbol_iter_by_addr"


1038 .Xr Plwp_getregs 3PROC ,
1039 .Xr Plwp_getspymaster 3PROC ,
1040 .Xr Plwp_main_stack 3PROC ,
1041 .Xr Plwp_setfpregs 3PROC ,
1042 .Xr Plwp_setregs 3PROC ,
1043 .Xr Plwp_stack 3PROC ,
1044 .Xr Pname_to_ctf 3PROC ,
1045 .Xr Pname_to_loadobj 3PROC ,
1046 .Xr Pname_to_map 3PROC ,
1047 .Xr Pobjname 3PROC ,
1048 .Xr Pobjname_resolved 3PROC ,
1049 .Xr Pplatform 3PROC ,
1050 .Xr Ppltdest 3PROC ,
1051 .Xr Ppriv 3PROC ,
1052 .Xr Ppsinfo 3PROC ,
1053 .Xr Pputareg 3PROC ,
1054 .Xr Prd_agent 3PROC ,
1055 .Xr Pread 3PROC ,
1056 .Xr Pread_string 3PROC ,
1057 .Xr Preset_maps 3PROC ,

1058 .Xr Psetbkpt 3PROC ,
1059 .Xr Psetcred 3PROC ,
1060 .Xr Psetfault 3PROC ,
1061 .Xr Psetflags 3PROC ,
1062 .Xr Psetpriv 3PROC ,
1063 .Xr Psetrun 3PROC ,
1064 .Xr Psetsignal 3PROC ,
1065 .Xr Psetsysentry 3PROC ,
1066 .Xr Psetsysexit 3PROC ,
1067 .Xr Psetwapt 3PROC ,
1068 .Xr Psetzoneid 3PROC ,
1069 .Xr Psignal 3PROC ,
1070 .Xr Pstate 3PROC ,
1071 .Xr Pstatus 3PROC ,
1072 .Xr Pstop 3PROC ,
1073 .Xr Pstopstatus 3PROC ,
1074 .Xr Psync 3PROC ,
1075 .Xr Psysentry 3PROC ,
1076 .Xr Psysexit 3PROC ,
1077 .Xr Puname 3PROC ,


   1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2015 Joyent, Inc.
  13 .\"
  14 .Dd June 06, 2016
  15 .Dt LIBPROC 3LIB
  16 .Os
  17 .Sh NAME
  18 .Nm libproc
  19 .Nd process control library
  20 .Sh SYNOPSIS
  21 .Lb libproc
  22 .In libproc.h
  23 .Sh DESCRIPTION
  24 The
  25 .Nm
  26 library provides consumers a general series of interfaces to inspect
  27 and control both live processes and core files. It is intended for
  28 introspection tools such as debuggers by providing a high-level
  29 interface to the /proc file system
  30 .Pf ( Xr proc 4 ) .
  31 .Pp
  32 The
  33 .Nm
  34 library provides interfaces that focus on:


 206 .It Sy Pdstop Ta Sy Pexecname
 207 .It Sy Pfault Ta Sy Pfgcore
 208 .It Sy Pgcore Ta Sy Pgetareg
 209 .It Sy Pgetauxval Ta Sy Pgetauxvec
 210 .It Sy Pgetenv Ta Sy Pisprocdir
 211 .It Sy Pissyscall_prev Ta Sy Plmid
 212 .It Sy Plmid_to_loadobj Ta Sy Plmid_to_map
 213 .It Sy Plookup_by_addr Ta Sy Plookup_by_name
 214 .It Sy Plwp_alt_stack Ta Sy Plwp_getfpregs
 215 .It Sy Plwp_getpsinfo Ta Sy Plwp_getregs
 216 .It Sy Plwp_getspymaster Ta Sy Plwp_main_stack
 217 .It Sy Plwp_setfpregs Ta Sy Plwp_setregs
 218 .It Sy Plwp_stack Ta Sy Pname_to_ctf
 219 .It Sy Pname_to_loadobj Ta Sy Pname_to_map
 220 .It Sy Pobjname Ta Sy Pobjname_resolved
 221 .It Sy Pplatform Ta Sy Ppltdest
 222 .It Sy Ppriv Ta Sy Ppsinfo
 223 .It Sy Pputareg Ta Sy Prd_agent
 224 .It Sy Pread Ta Sy Pread_string
 225 .It Sy Preset_maps Ta Sy Psetbkpt
 226 .It Sy Psecflags Ta Sy Psetcred
 227 .It Sy Psetfault Ta Sy Psetflags
 228 .It Sy Psetpriv Ta Sy Psetrun
 229 .It Sy Psetsignal Ta Sy Psetsysentry
 230 .It Sy Psetsysexit Ta Sy Psetwapt
 231 .It Sy Psetzoneid Ta Sy Psignal
 232 .It Sy Pstate Ta Sy Pstatus
 233 .It Sy Pstop Ta Sy Pstopstatus
 234 .It Sy Psync Ta Sy Psysentry
 235 .It Sy Psysexit Ta Sy Puname
 236 .It Sy Punsetflags Ta Sy Pupdate_maps
 237 .It Sy Pupdate_syms Ta Sy Pwait
 238 .It Sy Pwrite Ta Sy Pxecbkpt
 239 .It Sy Pxecwapt Ta Sy Pxlookup_by_addr
 240 .It Sy Pxlookup_by_addr_resolved Ta Sy Pxlookup_by_name
 241 .It Sy Pzonename Ta Sy Pzonepath
 242 .It Sy Pzoneroot Ta
 243 .El
 244 .Ss Thread interrogation and manipulation
 245 The following routines obtain information about a thread and allow
 246 manipulation of the thread itself.
 247 .Bl -column -offset indent ".Sy Pmapping_iter_resolved" ".Sy Psymbol_iter_by_addr"
 248 .It Sy Lalt_stack Ta Sy Lclearfault
 249 .It Sy Lclearsig Ta Sy Lctlfd
 250 .It Sy Ldstop Ta Sy Lgetareg
 251 .It Sy Lmain_stack Ta Sy Lprochandle
 252 .It Sy Lpsinfo Ta Sy Lputareg
 253 .It Sy Lsetrun Ta Sy Lstack
 254 .It Sy Lstate Ta Sy Lstatus
 255 .It Sy Lstop Ta Sy Lsync
 256 .It Sy Lwait Ta Sy Lxecbkpt
 257 .It Sy Lxecwapt Ta ""
 258 .El
 259 .Ss System Call Injection
 260 The following routines are used to inject specific system calls and have
 261 them run in the context of a process.
 262 .Bl -column -offset indent ".Sy Pmapping_iter_resolved" ".Sy Psymbol_iter_by_addr"


1039 .Xr Plwp_getregs 3PROC ,
1040 .Xr Plwp_getspymaster 3PROC ,
1041 .Xr Plwp_main_stack 3PROC ,
1042 .Xr Plwp_setfpregs 3PROC ,
1043 .Xr Plwp_setregs 3PROC ,
1044 .Xr Plwp_stack 3PROC ,
1045 .Xr Pname_to_ctf 3PROC ,
1046 .Xr Pname_to_loadobj 3PROC ,
1047 .Xr Pname_to_map 3PROC ,
1048 .Xr Pobjname 3PROC ,
1049 .Xr Pobjname_resolved 3PROC ,
1050 .Xr Pplatform 3PROC ,
1051 .Xr Ppltdest 3PROC ,
1052 .Xr Ppriv 3PROC ,
1053 .Xr Ppsinfo 3PROC ,
1054 .Xr Pputareg 3PROC ,
1055 .Xr Prd_agent 3PROC ,
1056 .Xr Pread 3PROC ,
1057 .Xr Pread_string 3PROC ,
1058 .Xr Preset_maps 3PROC ,
1059 .Xr Psecflags 3PROC ,
1060 .Xr Psetbkpt 3PROC ,
1061 .Xr Psetcred 3PROC ,
1062 .Xr Psetfault 3PROC ,
1063 .Xr Psetflags 3PROC ,
1064 .Xr Psetpriv 3PROC ,
1065 .Xr Psetrun 3PROC ,
1066 .Xr Psetsignal 3PROC ,
1067 .Xr Psetsysentry 3PROC ,
1068 .Xr Psetsysexit 3PROC ,
1069 .Xr Psetwapt 3PROC ,
1070 .Xr Psetzoneid 3PROC ,
1071 .Xr Psignal 3PROC ,
1072 .Xr Pstate 3PROC ,
1073 .Xr Pstatus 3PROC ,
1074 .Xr Pstop 3PROC ,
1075 .Xr Pstopstatus 3PROC ,
1076 .Xr Psync 3PROC ,
1077 .Xr Psysentry 3PROC ,
1078 .Xr Psysexit 3PROC ,
1079 .Xr Puname 3PROC ,