xref: /freebsd/usr.bin/proccontrol/proccontrol.1 (revision 06c3fb27)
1.\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
2.\" All rights reserved.
3.\"
4.\" This documentation was written by
5.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
6.\" from the FreeBSD Foundation.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd October 5, 2023
30.Dt PROCCONTROL 1
31.Os
32.Sh NAME
33.Nm proccontrol
34.Nd Control some process execution aspects
35.Sh SYNOPSIS
36.Nm
37.Fl m Ar mode
38.Op Fl s Ar control
39.Op Fl q
40.Fl p Ar pid | command
41.Sh DESCRIPTION
42The
43.Nm
44command modifies the execution parameter of existing process
45specified by the
46.Ar pid
47argument, or starts execution of the new program
48.Ar command
49with the execution parameter set for it.
50.Pp
51Which execution parameter is changed, selected by the mandatory
52parameter
53.Ar mode .
54Possible values for
55.Ar mode
56are:
57.Bl -tag -width trapcap
58.It Ar aslr
59Control the Address Space Layout Randomization.
60Only applicable to the new process spawned.
61.It Ar trace
62Control the permission for debuggers to attach.
63Note that process is only allowed to enable tracing for itself,
64not for any other process.
65.It Ar trapcap
66Controls the signalling of capability mode access violations.
67.It Ar protmax
68Controls the implicit PROT_MAX application for
69.Xr mmap 2 .
70.It Ar nonewprivs
71Controls disabling the setuid and sgid bits for
72.Xr execve 2 .
73.It Ar wxmap
74Controls the write exclusive execute mode for mappings.
75.It Ar kpti
76Controls the KPTI enable, AMD64 only.
77.It Ar la48
78Control limiting usermode process address space to 48 bits of address,
79AMD64 only, on machines capable of 57-bit addressing.
80.El
81.Pp
82The
83.Ar control
84specifies if the selected
85.Ar mode
86should be enabled or disabled.
87Possible values are
88.Ar enable
89and
90.Ar disable ,
91with the default value being
92.Ar enable
93if not specified.
94See
95.Xr procctl 2
96for detailed description of each mode effects and interaction with other
97process control facilities.
98.Pp
99The
100.Fl q
101switch makes the utility query and print the current setting for
102the selected mode.
103The
104.Fl q
105requires the query target process specification with
106.Fl p .
107.Sh EXIT STATUS
108.Ex -std
109.Sh EXAMPLES
110.Bl -bullet
111.It
112To disable debuggers attachment to the process 1020, execute
113.Dl "proccontrol -m trace -s disable -p 1020"
114.It
115To execute the
116.Xr uniq 1
117program in a mode where capability access violations cause
118.Dv SIGTRAP
119delivery, do
120.Dl "proccontrol -m trapcap uniq"
121.It
122To query the current ASLR enablement mode for the running
123process 1020, do
124.Dl "proccontrol -m aslr -q -p 1020"
125.El
126.Sh SEE ALSO
127.Xr kill 2 ,
128.Xr procctl 2 ,
129.Xr ptrace 2 ,
130.Xr mitigations 7
131.Sh HISTORY
132The
133.Nm
134command appeared in
135.Fx 10.0 .
136.Sh AUTHORS
137The
138.Nm
139command and this manual page were written by
140.An Konstantin Belousov Aq Mt kib@freebsd.org
141under sponsorship from The FreeBSD Foundation.
142