xref: /netbsd-src/usr.sbin/paxctl/paxctl.8 (revision 52043314dd8749c8bbed8615cdde1f74283a4ee0)
1.\"	$NetBSD: paxctl.8,v 1.22 2023/08/21 00:41:49 dholland Exp $
2.\"
3.\" Copyright 2006 Elad Efrat <elad@NetBSD.org>
4.\" Copyright 2008 Christos Zoulas <christos@NetBSD.org>
5.\" All rights reserved.
6.\"
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. The name of the author may not be used to endorse or promote products
13.\"    derived from this software without specific prior written permission.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.Dd August 20, 2023
27.Dt PAXCTL 8
28.Os
29.Sh NAME
30.Nm paxctl
31.Nd list and modify PaX flags associated with an ELF program
32.Sh SYNOPSIS
33.Nm
34.Op Fl 0 | Ar flags
35.Ar program ...
36.Sh DESCRIPTION
37The
38.Nm
39utility is used to list and manipulate PaX flags associated with an ELF
40program.
41The PaX flags signify to the loader the privilege protections to be applied
42to mapped memory pages, and fuller explanations of the specific protections
43can be found in the
44.Xr security 7
45manpage.
46.Pp
47To view existing flags on a
48.Ar program ,
49execute
50.Nm
51without any flags.
52.Pp
53If
54.Fl 0
55option is specified, all PaX flags
56.Pq including reserved bits
57are cleared.
58Otherwise, each flag can be prefixed either with a
59.Sq Cm +
60or a
61.Sq Fl
62sign to add or remove the flag, respectively.
63.Pp
64The following flags are available:
65.Pp
66.Bl -tag -width Ds -compact
67.It Cm a
68Explicitly disable PaX ASLR (Address Space Layout Randomization).
69.It Cm A
70Explicitly enable PaX ASLR.
71.Pp
72.It Cm g
73Explicitly disable PaX Segvguard.
74.It Cm G
75Explicitly enable PaX Segvguard.
76.Pp
77.It Cm m
78Explicitly disable PaX MPROTECT
79.Po Xr mprotect 2
80restrictions
81.Pc .
82.It Cm M
83Explicitly enable PaX MPROTECT.
84.El
85.
86.Sh SEE ALSO
87.Xr mprotect 2 ,
88.Xr sysctl 3 ,
89.Xr options 4 ,
90.Xr elf 5 ,
91.Xr security 7 ,
92.Xr sysctl 8 ,
93.Xr fileassoc 9
94.Sh HISTORY
95The
96.Nm
97utility first appeared in
98.Nx 4.0 .
99.Pp
100The
101.Nm
102utility is modeled after a tool of the same name available for Linux from the
103PaX project.
104.Sh AUTHORS
105.An Elad Efrat Aq Mt elad@NetBSD.org
106.An Christos Zoulas Aq Mt christos@NetBSD.org
107.Sh RESTRICTIONS
108The
109.Nm
110utility uses
111.Xr elf 5
112note sections to mark executables with PaX flags.
113This means that, as one might expect, the PaX settings do not persist
114if the program file is replaced.
115It also means that running
116.Nm
117changes the target executable, which can be undesirable in production.
118In general,
119.Nm
120settings should be applied to programs at build time.
121