NetBSD/usr.sbin/paxctl/paxctl.8

121 lines
3.3 KiB
Groff

.\" $NetBSD: paxctl.8,v 1.22 2023/08/21 00:41:49 dholland Exp $
.\"
.\" Copyright 2006 Elad Efrat <elad@NetBSD.org>
.\" Copyright 2008 Christos Zoulas <christos@NetBSD.org>
.\" All rights reserved.
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 20, 2023
.Dt PAXCTL 8
.Os
.Sh NAME
.Nm paxctl
.Nd list and modify PaX flags associated with an ELF program
.Sh SYNOPSIS
.Nm
.Op Fl 0 | Ar flags
.Ar program ...
.Sh DESCRIPTION
The
.Nm
utility is used to list and manipulate PaX flags associated with an ELF
program.
The PaX flags signify to the loader the privilege protections to be applied
to mapped memory pages, and fuller explanations of the specific protections
can be found in the
.Xr security 7
manpage.
.Pp
To view existing flags on a
.Ar program ,
execute
.Nm
without any flags.
.Pp
If
.Fl 0
option is specified, all PaX flags
.Pq including reserved bits
are cleared.
Otherwise, each flag can be prefixed either with a
.Sq Cm +
or a
.Sq Fl
sign to add or remove the flag, respectively.
.Pp
The following flags are available:
.Pp
.Bl -tag -width Ds -compact
.It Cm a
Explicitly disable PaX ASLR (Address Space Layout Randomization).
.It Cm A
Explicitly enable PaX ASLR.
.Pp
.It Cm g
Explicitly disable PaX Segvguard.
.It Cm G
Explicitly enable PaX Segvguard.
.Pp
.It Cm m
Explicitly disable PaX MPROTECT
.Po Xr mprotect 2
restrictions
.Pc .
.It Cm M
Explicitly enable PaX MPROTECT.
.El
.
.Sh SEE ALSO
.Xr mprotect 2 ,
.Xr sysctl 3 ,
.Xr options 4 ,
.Xr elf 5 ,
.Xr security 7 ,
.Xr sysctl 8 ,
.Xr fileassoc 9
.Sh HISTORY
The
.Nm
utility first appeared in
.Nx 4.0 .
.Pp
The
.Nm
utility is modeled after a tool of the same name available for Linux from the
PaX project.
.Sh AUTHORS
.An Elad Efrat Aq Mt elad@NetBSD.org
.An Christos Zoulas Aq Mt christos@NetBSD.org
.Sh RESTRICTIONS
The
.Nm
utility uses
.Xr elf 5
note sections to mark executables with PaX flags.
This means that, as one might expect, the PaX settings do not persist
if the program file is replaced.
It also means that running
.Nm
changes the target executable, which can be undesirable in production.
In general,
.Nm
settings should be applied to programs at build time.