]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/sys/procctl.2
wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff
[FreeBSD/FreeBSD.git] / lib / libc / sys / procctl.2
1 .\" Copyright (c) 2013 Hudson River Trading LLC
2 .\" Written by: John H. Baldwin <jhb@FreeBSD.org>
3 .\" All rights reserved.
4 .\"
5 .\" Copyright (c) 2014 The FreeBSD Foundation
6 .\" Portions of this documentation were written by Konstantin Belousov
7 .\" under sponsorship from the FreeBSD Foundation.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd July 1, 2021
33 .Dt PROCCTL 2
34 .Os
35 .Sh NAME
36 .Nm procctl
37 .Nd control processes
38 .Sh LIBRARY
39 .Lb libc
40 .Sh SYNOPSIS
41 .In sys/procctl.h
42 .Ft int
43 .Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *data"
44 .Sh DESCRIPTION
45 The
46 .Fn procctl
47 system call provides for control over processes.
48 The
49 .Fa idtype
50 and
51 .Fa id
52 arguments specify the set of processes to control.
53 If multiple processes match the identifier,
54 .Nm
55 will make a
56 .Dq best effort
57 to control as many of the selected processes as possible.
58 An error is only returned if no selected processes successfully complete
59 the request.
60 The following identifier types are supported:
61 .Bl -tag -width P_PGID
62 .It Dv P_PID
63 Control the process with the process ID
64 .Fa id .
65 .It Dv P_PGID
66 Control processes belonging to the process group with the ID
67 .Fa id .
68 .El
69 .Pp
70 The control request to perform is specified by the
71 .Fa cmd
72 argument.
73 The following commands are supported:
74 .Bl -tag -width PROC_TRAPCAP_STATUS
75 .It Dv PROC_ASLR_CTL
76 Controls the Address Space Layout Randomization (ASLR) in the program
77 images created
78 by
79 .Xr execve 2
80 in the specified process or its descendants that did not changed
81 the control nor modified it by other means.
82 The
83 .Fa data
84 parameter must point to the integer variable holding one of the following
85 values:
86 .Bl -tag -width PROC_ASLR_FORCE_DISABLE
87 .It Dv PROC_ASLR_FORCE_ENABLE
88 Request that ASLR is enabled after execution, even if it is disabled
89 system-wide.
90 The image flag and set-uid might prevent ASLR enablement still.
91 .It Dv PROC_ASLR_FORCE_DISABLE
92 Request that ASLR is disabled after execution.
93 Same notes as for
94 .Dv PROC_ASLR_FORCE_ENABLE
95 apply.
96 .It Dv PROC_ASLR_NOFORCE
97 Use the system-wide configured policy for ASLR.
98 .El
99 .It Dv PROC_ASLR_STATUS
100 Returns the current status of ASLR enablement for the target process.
101 The
102 .Fa data
103 parameter must point to the integer variable, where one of the
104 following values is written:
105 .Bl -tag -width PROC_ASLR_FORCE_DISABLE
106 .It Dv PROC_ASLR_FORCE_ENABLE
107 .It Dv PROC_ASLR_FORCE_DISABLE
108 .It Dv PROC_ASLR_NOFORCE
109 .El
110 .Pp
111 If the currently executed image in the process itself has ASLR enabled,
112 the
113 .Dv PROC_ASLR_ACTIVE
114 flag is or-ed with the value listed above.
115 .It Dv PROC_PROTMAX_CTL
116 Controls implicit application of PROT_MAX protection equal to the
117 .Fa prot
118 argument of the
119 .Xr mmap 2
120 syscall, in the target process.
121 The
122 .Fa data
123 parameter must point to the integer variable holding one of the following
124 values:
125 .Bl -tag -width PROC_PROTMAX_FORCE_DISABLE
126 .It Dv PROC_PROTMAX_FORCE_ENABLE
127 Enables implicit PROT_MAX application,
128 even if it is disabled system-wide by the sysctl
129 .Va vm.imply_prot_max .
130 The image flag might still prevent the enablement.
131 .It Dv PROC_PROTMAX_FORCE_DISABLE
132 Request that implicit application of PROT_MAX be disabled.
133 Same notes as for
134 .Dv PROC_PROTMAX_FORCE_ENABLE
135 apply.
136 .It Dv PROC_PROTMAX_NOFORCE
137 Use the system-wide configured policy for PROT_MAX.
138 .El
139 .It Dv PROC_PROTMAX_STATUS
140 Returns the current status of implicit PROT_MAX enablement for the
141 target process.
142 The
143 .Fa data
144 parameter must point to the integer variable, where one of the
145 following values is written:
146 .Bl -tag -width PROC_PROTMAX_FORCE_DISABLE
147 .It Dv PROC_PROTMAX_FORCE_ENABLE
148 .It Dv PROC_PROTMAX_FORCE_DISABLE
149 .It Dv PROC_PROTMAX_NOFORCE
150 .El
151 .Pp
152 If the currently executed image in the process itself has implicit PROT_MAX
153 application enabled, the
154 .Dv PROC_PROTMAX_ACTIVE
155 flag is or-ed with the value listed above.
156 .It Dv PROC_SPROTECT
157 Set process protection state.
158 This is used to mark a process as protected from being killed if the system
159 exhausts the available memory and swap.
160 The
161 .Fa data
162 parameter must point to an integer containing an operation and zero or more
163 optional flags.
164 The following operations are supported:
165 .Bl -tag -width PPROT_CLEAR
166 .It Dv PPROT_SET
167 Mark the selected processes as protected.
168 .It Dv PPROT_CLEAR
169 Clear the protected state of selected processes.
170 .El
171 .Pp
172 The following optional flags are supported:
173 .Bl -tag -width PPROT_DESCEND
174 .It Dv PPROT_DESCEND
175 Apply the requested operation to all child processes of each selected process
176 in addition to each selected process.
177 .It Dv PPROT_INHERIT
178 When used with
179 .Dv PPROT_SET ,
180 mark all future child processes of each selected process as protected.
181 Future child processes will also mark all of their future child processes.
182 .El
183 .It Dv PROC_REAP_ACQUIRE
184 Acquires the reaper status for the current process.
185 Reaper status means that children orphaned by the reaper's descendants
186 that were forked after the acquisition of reaper status are reparented to the
187 reaper process.
188 After system initialization,
189 .Xr init 8
190 is the default reaper.
191 .It Dv PROC_REAP_RELEASE
192 Release the reaper state for the current process.
193 The reaper of the current process becomes the new reaper of the
194 current process's descendants.
195 .It Dv PROC_REAP_STATUS
196 Provides information about the reaper of the specified process,
197 or the process itself when it is a reaper.
198 The
199 .Fa data
200 argument must point to a
201 .Vt procctl_reaper_status
202 structure which is filled in by the syscall on successful return.
203 .Bd -literal
204 struct procctl_reaper_status {
205         u_int   rs_flags;
206         u_int   rs_children;
207         u_int   rs_descendants;
208         pid_t   rs_reaper;
209         pid_t   rs_pid;
210 };
211 .Ed
212 The
213 .Fa rs_flags
214 may have the following flags returned:
215 .Bl -tag -width REAPER_STATUS_REALINIT
216 .It Dv REAPER_STATUS_OWNED
217 The specified process has acquired reaper status and has not
218 released it.
219 When the flag is returned, the specified process
220 .Fa id ,
221 pid, identifies the reaper, otherwise the
222 .Fa rs_reaper
223 field of the structure is set to the pid of the reaper
224 for the specified process id.
225 .It Dv REAPER_STATUS_REALINIT
226 The specified process is the root of the reaper tree, i.e.,
227 .Xr init 8 .
228 .El
229 .Pp
230 The
231 .Fa rs_children
232 field returns the number of children of the reaper among the descendants.
233 It is possible to have a child whose reaper is not the specified process,
234 since the reaper for any existing children is not reset on the
235 .Dv PROC_REAP_ACQUIRE
236 operation.
237 The
238 .Fa rs_descendants
239 field returns the total number of descendants of the reaper(s),
240 not counting descendants of the reaper in the subtree.
241 The
242 .Fa rs_reaper
243 field returns the reaper pid.
244 The
245 .Fa rs_pid
246 returns the pid of one reaper child if there are any descendants.
247 .It Dv PROC_REAP_GETPIDS
248 Queries the list of descendants of the reaper of the specified process.
249 The request takes a pointer to a
250 .Vt procctl_reaper_pids
251 structure in the
252 .Fa data
253 parameter.
254 .Bd -literal
255 struct procctl_reaper_pids {
256         u_int   rp_count;
257         struct procctl_reaper_pidinfo *rp_pids;
258 };
259 .Ed
260 When called, the
261 .Fa rp_pids
262 field must point to an array of
263 .Vt procctl_reaper_pidinfo
264 structures, to be filled in on return,
265 and the
266 .Fa rp_count
267 field must specify the size of the array,
268 into which no more than
269 .Fa rp_count
270 elements will be filled in by the kernel.
271 .Pp
272 The
273 .Vt "struct procctl_reaper_pidinfo"
274 structure provides some information about one of the reaper's descendants.
275 Note that for a descendant that is not a child, it may be incorrectly
276 identified because of a race in which the original child process exited
277 and the exited process's pid was reused for an unrelated process.
278 .Bd -literal
279 struct procctl_reaper_pidinfo {
280         pid_t   pi_pid;
281         pid_t   pi_subtree;
282         u_int   pi_flags;
283 };
284 .Ed
285 The
286 .Fa pi_pid
287 field is the process id of the descendant.
288 The
289 .Fa pi_subtree
290 field provides the pid of the child of the reaper, which is the (grand-)parent
291 of the process.
292 The
293 .Fa pi_flags
294 field returns the following flags, further describing the descendant:
295 .Bl -tag -width REAPER_PIDINFO_REAPER
296 .It Dv REAPER_PIDINFO_VALID
297 Set to indicate that the
298 .Vt procctl_reaper_pidinfo
299 structure was filled in by the kernel.
300 Zero-filling the
301 .Fa rp_pids
302 array and testing the
303 .Dv REAPER_PIDINFO_VALID
304 flag allows the caller to detect the end
305 of the returned array.
306 .It Dv REAPER_PIDINFO_CHILD
307 The
308 .Fa pi_pid
309 field identifies the direct child of the reaper.
310 .It Dv REAPER_PIDINFO_REAPER
311 The reported process is itself a reaper.
312 The descendants of the subordinate reaper are not reported.
313 .El
314 .It Dv PROC_REAP_KILL
315 Request to deliver a signal to some subset of the descendants of the reaper.
316 The
317 .Fa data
318 parameter must point to a
319 .Vt procctl_reaper_kill
320 structure, which is used both for parameters and status return.
321 .Bd -literal
322 struct procctl_reaper_kill {
323         int     rk_sig;
324         u_int   rk_flags;
325         pid_t   rk_subtree;
326         u_int   rk_killed;
327         pid_t   rk_fpid;
328 };
329 .Ed
330 The
331 .Fa rk_sig
332 field specifies the signal to be delivered.
333 Zero is not a valid signal number, unlike for
334 .Xr kill 2 .
335 The
336 .Fa rk_flags
337 field further directs the operation.
338 It is or-ed from the following flags:
339 .Bl -tag -width REAPER_KILL_CHILDREN
340 .It Dv REAPER_KILL_CHILDREN
341 Deliver the specified signal only to direct children of the reaper.
342 .It Dv REAPER_KILL_SUBTREE
343 Deliver the specified signal only to descendants that were forked by
344 the direct child with pid specified in the
345 .Fa rk_subtree
346 field.
347 .El
348 If neither the
349 .Dv REAPER_KILL_CHILDREN
350 nor the
351 .Dv REAPER_KILL_SUBTREE
352 flags are specified, all current descendants of the reaper are signalled.
353 .Pp
354 If a signal was delivered to any process, the return value from the request
355 is zero.
356 In this case, the
357 .Fa rk_killed
358 field identifies the number of processes signalled.
359 The
360 .Fa rk_fpid
361 field is set to the pid of the first process for which signal
362 delivery failed, e.g., due to permission problems.
363 If no such process exists, the
364 .Fa rk_fpid
365 field is set to -1.
366 .It Dv PROC_TRACE_CTL
367 Enable or disable tracing of the specified process(es), according to the
368 value of the integer argument.
369 Tracing includes attachment to the process using the
370 .Xr ptrace 2
371 and
372 .Xr ktrace 2 ,
373 debugging sysctls,
374 .Xr hwpmc 4 ,
375 .Xr dtrace 1 ,
376 and core dumping.
377 Possible values for the
378 .Fa data
379 argument are:
380 .Bl -tag -width PROC_TRACE_CTL_DISABLE_EXEC
381 .It Dv PROC_TRACE_CTL_ENABLE
382 Enable tracing, after it was disabled by
383 .Dv PROC_TRACE_CTL_DISABLE .
384 Only allowed for self.
385 .It Dv PROC_TRACE_CTL_DISABLE
386 Disable tracing for the specified process.
387 Tracing is re-enabled when the process changes the executing
388 program with the
389 .Xr execve 2
390 syscall.
391 A child inherits the trace settings from the parent on
392 .Xr fork 2 .
393 .It Dv PROC_TRACE_CTL_DISABLE_EXEC
394 Same as
395 .Dv PROC_TRACE_CTL_DISABLE ,
396 but the setting persists for the process even after
397 .Xr execve 2 .
398 .El
399 .It Dv PROC_TRACE_STATUS
400 Returns the current tracing status for the specified process in
401 the integer variable pointed to by
402 .Fa data .
403 If tracing is disabled,
404 .Fa data
405 is set to -1.
406 If tracing is enabled, but no debugger is attached by the
407 .Xr ptrace 2
408 syscall,
409 .Fa data
410 is set to 0.
411 If a debugger is attached,
412 .Fa data
413 is set to the pid of the debugger process.
414 .It Dv PROC_TRAPCAP_CTL
415 Controls the capability mode sandbox actions for the specified
416 sandboxed processes,
417 on a return from any syscall which gives either a
418 .Er ENOTCAPABLE
419 or
420 .Er ECAPMODE
421 error.
422 If the control is enabled, such errors from the syscalls cause
423 delivery of the synchronous
424 .Dv SIGTRAP
425 signal to the thread immediately before returning from the syscalls.
426 .Pp
427 Possible values for the
428 .Fa data
429 argument are:
430 .Bl -tag -width PROC_TRAPCAP_CTL_DISABLE
431 .It Dv PROC_TRAPCAP_CTL_ENABLE
432 Enable the
433 .Dv SIGTRAP
434 signal delivery on capability mode access violations.
435 The enabled mode is inherited by the children of the process,
436 and is kept after
437 .Xr fexecve 2
438 calls.
439 .It Dv PROC_TRAPCAP_CTL_DISABLE
440 Disable the signal delivery on capability mode access violations.
441 Note that the global sysctl
442 .Dv kern.trap_enotcap
443 might still cause the signal to be delivered.
444 See
445 .Xr capsicum 4 .
446 .El
447 .Pp
448 On signal delivery, the
449 .Va si_errno
450 member of the
451 .Fa siginfo
452 signal handler parameter is set to the syscall error value,
453 and the
454 .Va si_code
455 member is set to
456 .Dv TRAP_CAP .
457 The system call number is stored in the
458 .Va si_syscall
459 field of the
460 .Fa siginfo
461 signal handler parameter.
462 The other system call parameters can be read from the
463 .Fa ucontext_t
464 but the system call number is typically stored in the register
465 that also contains the return value and so is unavailable in the
466 signal handler.
467 .Pp
468 See
469 .Xr capsicum 4
470 for more information about the capability mode.
471 .It Dv PROC_TRAPCAP_STATUS
472 Return the current status of signalling capability mode access
473 violations for the specified process.
474 The integer value pointed to by the
475 .Fa data
476 argument is set to the
477 .Dv PROC_TRAPCAP_CTL_ENABLE
478 value if the process control enables signal delivery, and to
479 .Dv PROC_TRAPCAP_CTL_DISABLE
480 otherwise.
481 .Pp
482 See the note about sysctl
483 .Dv kern.trap_enotcap
484 above, which gives independent global control of signal delivery.
485 .It Dv PROC_PDEATHSIG_CTL
486 Request the delivery of a signal when the parent of the calling
487 process exits.
488 .Fa idtype
489 must be
490 .Dv P_PID
491 and
492 .Fa id
493 must be the either caller's pid or zero, with no difference in effect.
494 The value is cleared for child processes
495 and when executing set-user-ID or set-group-ID binaries.
496 .Fa data
497 must point to a value of type
498 .Vt int
499 indicating the signal
500 that should be delivered to the caller.
501 Use zero to cancel a previously requested signal delivery.
502 .It Dv PROC_PDEATHSIG_STATUS
503 Query the current signal number that will be delivered when the parent
504 of the calling process exits.
505 .Fa idtype
506 must be
507 .Dv P_PID
508 and
509 .Fa id
510 must be the either caller's pid or zero, with no difference in effect.
511 .Fa data
512 must point to a memory location that can hold a value of type
513 .Vt int .
514 If signal delivery has not been requested, it will contain zero
515 on return.
516 .It Dv PROC_STACKGAP_CTL
517 Controls the stack gaps in the specified process.
518 A stack gap is the part of the growth area for a
519 .Dv MAP_STACK
520 mapped region that is reserved and never filled by memory.
521 Instead, the process is guaranteed to receive a
522 .Dv SIGSEGV
523 signal on accessing pages in the gap.
524 Gaps protect against stack overflow corrupting memory adjacent
525 to the stack.
526 .Pp
527 The
528 .Fa data
529 argument must point to an integer variable containing flags.
530 The following flags are allowed:
531 .Bl -tag -width PROC_STACKGAP_DISABLE_EXEC
532 .It Dv PROC_STACKGAP_ENABLE
533 This flag is only accepted for consistency with
534 .Dv PROC_STACKGAP_STATUS .
535 If stack gaps are enabled, the flag is ignored.
536 If disabled, the flag causes an
537 .Ev EINVAL
538 error to be returned.
539 After gaps are disabled in a process, they can only be re-enabled when an
540 .Xr execve 2
541 is performed.
542 .It Dv PROC_STACKGAP_DISABLE
543 Disable stack gaps for the process.
544 For existing stacks, the gap is no longer a reserved part of the growth
545 area and can be filled by memory on access.
546 .It Dv PROC_STACKGAP_ENABLE_EXEC
547 Enable stack gaps for programs started after an
548 .Xr execve 2
549 by the specified process.
550 .It Dv PROC_STACKGAP_DISABLE_EXEC
551 Inherit disabled stack gaps state after
552 .Xr execve 2 .
553 In other words, if the currently executing program has stack gaps disabled,
554 they are kept disabled on exec.
555 If gaps were enabled, they are kept enabled after exec.
556 .El
557 .Pp
558 The stack gap state is inherited from the parent on
559 .Xr fork 2 .
560 .It Dv PROC_STACKGAP_STATUS
561 Returns the current stack gap state for the specified process.
562 .Fa data
563 must point to an integer variable, which is used to return a bitmask
564 consisting of the following flags:
565 .Bl -tag -width PROC_STACKGAP_DISABLE_EXEC
566 .It Dv PROC_STACKGAP_ENABLE
567 Stack gaps are enabled.
568 .It Dv PROC_STACKGAP_DISABLE
569 Stack gaps are disabled.
570 .It Dv PROC_STACKGAP_ENABLE_EXEC
571 Stack gaps are enabled in the process after
572 .Xr execve 2 .
573 .It Dv PROC_STACKGAP_DISABLE_EXEC
574 Stack gaps are disabled in the process after
575 .Xr execve 2 .
576 .El
577 .It Dv PROC_NO_NEW_PRIVS_CTL
578 Allows one to ignore the SUID and SGID bits on the program
579 images activated by
580 .Xr execve 2
581 in the specified process and its future descendants.
582 The
583 .Fa data
584 parameter must point to the integer variable holding the following
585 value:
586 .Bl -tag -width PROC_NO_NEW_PRIVS_ENABLE
587 .It Dv PROC_NO_NEW_PRIVS_ENABLE
588 Request SUID and SGID bits to be ignored.
589 .El
590 .Pp
591 It is not possible to disable it once it has been enabled.
592 .It Dv PROC_NO_NEW_PRIVS_STATUS
593 Returns the current status of SUID/SGID enablement for the target process.
594 The
595 .Fa data
596 parameter must point to the integer variable, where one of the
597 following values is written:
598 .Bl -tag -width PROC_NO_NEW_PRIVS_DISABLE
599 .It Dv PROC_NO_NEW_PRIVS_ENABLE
600 .It Dv PROC_NO_NEW_PRIVS_DISABLE
601 .El
602 .El
603 .Sh x86 MACHINE-SPECIFIC REQUESTS
604 .Bl -tag -width PROC_KPTI_STATUS
605 .It Dv PROC_KPTI_CTL
606 AMD64 only.
607 Controls the Kernel Page Table Isolation (KPTI) option for the children
608 of the specified process.
609 For the command to work, the
610 .Va vm.pmap.kpti
611 tunable must be enabled on boot.
612 It is not possible to change the KPTI setting for a running process,
613 except at the
614 .Xr execve 2 ,
615 where the address space is reinitialized.
616 .Pp
617 The
618 .Fa data
619 parameter must point to an integer variable containing one of the
620 following commands:
621 .Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC
622 .It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC
623 Enable KPTI after
624 .Xr execve 2 .
625 .It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC
626 Disable KPTI after
627 .Xr execve 2 .
628 Only root or a process having the
629 .Va PRIV_IO
630 privilege might use this option.
631 .El
632 .It Dv PROC_KPTI_STATUS
633 Returns the current KPTI status for the specified process.
634 .Fa data
635 must point to the integer variable, which returns the
636 following statuses:
637 .Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC
638 .It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC
639 .It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC
640 .El
641 .Pp
642 The status is or-ed with the
643 .Va PROC_KPTI_STATUS_ACTIVE
644 in case KPTI is active for the current address space of the process.
645 .Sh NOTES
646 Disabling tracing on a process should not be considered a security
647 feature, as it is bypassable both by the kernel and privileged processes,
648 and via other system mechanisms.
649 As such, it should not be utilized to reliably protect cryptographic
650 keying material or other confidential data.
651 .Sh RETURN VALUES
652 If an error occurs, a value of -1 is returned and
653 .Va errno
654 is set to indicate the error.
655 .Sh ERRORS
656 The
657 .Fn procctl
658 system call
659 will fail if:
660 .Bl -tag -width Er
661 .It Bq Er EFAULT
662 The
663 .Fa data
664 parameter points outside the process's allocated address space.
665 .It Bq Er EINVAL
666 The
667 .Fa cmd
668 argument specifies an unsupported command.
669 .Pp
670 The
671 .Fa idtype
672 argument specifies an unsupported identifier type.
673 .It Bq Er EPERM
674 The calling process does not have permission to perform the requested
675 operation on any of the selected processes.
676 .It Bq Er ESRCH
677 No processes matched the requested
678 .Fa idtype
679 and
680 .Fa id .
681 .It Bq Er EINVAL
682 An invalid operation or flag was passed in
683 .Fa data
684 for a
685 .Dv PROC_SPROTECT
686 command.
687 .It Bq Er EPERM
688 The
689 .Fa idtype
690 argument is not equal to
691 .Dv P_PID ,
692 or
693 .Fa id
694 is not equal to the pid of the calling process, for
695 .Dv PROC_REAP_ACQUIRE
696 or
697 .Dv PROC_REAP_RELEASE
698 requests.
699 .It Bq Er EINVAL
700 Invalid or undefined flags were passed to a
701 .Dv PROC_REAP_KILL
702 request.
703 .It Bq Er EINVAL
704 An invalid or zero signal number was requested for a
705 .Dv PROC_REAP_KILL
706 request.
707 .It Bq Er EINVAL
708 The
709 .Dv PROC_REAP_RELEASE
710 request was issued by the
711 .Xr init 8
712 process.
713 .It Bq Er EBUSY
714 The
715 .Dv PROC_REAP_ACQUIRE
716 request was issued by a process that had already acquired reaper status
717 and has not yet released it.
718 .It Bq Er EBUSY
719 The
720 .Dv PROC_TRACE_CTL
721 request was issued for a process already being traced.
722 .It Bq Er EPERM
723 The
724 .Dv PROC_TRACE_CTL
725 request to re-enable tracing of the process
726 .Po Dv PROC_TRACE_CTL_ENABLE Pc ,
727 or to disable persistence of
728 .Dv PROC_TRACE_CTL_DISABLE
729 on
730 .Xr execve 2
731 was issued for a non-current process.
732 .It Bq Er EINVAL
733 The value of the integer
734 .Fa data
735 parameter for the
736 .Dv PROC_TRACE_CTL
737 or
738 .Dv PROC_TRAPCAP_CTL
739 request is invalid.
740 .It Bq Er EINVAL
741 The
742 .Dv PROC_PDEATHSIG_CTL
743 or
744 .Dv PROC_PDEATHSIG_STATUS
745 request referenced an unsupported
746 .Fa id ,
747 .Fa idtype
748 or invalid signal number.
749 .El
750 .Sh SEE ALSO
751 .Xr dtrace 1 ,
752 .Xr proccontrol 1 ,
753 .Xr protect 1 ,
754 .Xr cap_enter 2 ,
755 .Xr kill 2 ,
756 .Xr ktrace 2 ,
757 .Xr mmap 2 ,
758 .Xr mprotect 2 ,
759 .Xr ptrace 2 ,
760 .Xr wait 2 ,
761 .Xr capsicum 4 ,
762 .Xr hwpmc 4 ,
763 .Xr init 8
764 .Sh HISTORY
765 The
766 .Fn procctl
767 function appeared in
768 .Fx 10.0 .
769 .Pp
770 The reaper facility is based on a similar feature of Linux and
771 DragonflyBSD, and first appeared in
772 .Fx 10.2 .
773 .Pp
774 The
775 .Dv PROC_PDEATHSIG_CTL
776 facility is based on the prctl(PR_SET_PDEATHSIG, ...) feature of Linux,
777 and first appeared in
778 .Fx 11.2 .
779 .Pp
780 The ASLR support was added to system for the checklists compliance in
781 .Fx 13.0 .