xref: /freebsd/usr.bin/elfctl/elfctl.1 (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1.\" Copyright 2019 The FreeBSD Foundation.
2.\"
3.\" This software was developed by Bora Ozarslan under sponsorship from
4.\" the FreeBSD Foundation.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
16.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd October 5, 2023
28.Dt ELFCTL 1
29.Os
30.Sh NAME
31.Nm elfctl
32.Nd change an ELF binary's feature control note
33.Sh SYNOPSIS
34.Nm
35.Op Fl h | Fl -help
36.Op Fl i
37.Op Fl l
38.Op Fl e Ar featurelist
39.Ar
40.Sh DESCRIPTION
41The
42.Nm
43utility modifies feature flags in the feature control note in an ELF binary.
44.Pp
45The options are as follows:
46.Bl -tag -width indent
47.It Fl h | Fl -help
48Print a usage message and exit.
49.It Fl i
50Ignore unknown feature flags in
51.Ar featurelist .
52.It Fl l
53List known ELF feature flags.
54.It Fl e Ar featurelist
55Edit features from the given comma separated list
56.Ar featurelist .
57.Ar featurelist
58starts with one of the three operations:
59.Dq Li +
60to turn on the features,
61.Dq Li -
62to turn off the features,
63.Dq Li =
64to only turn on the given features.
65A comma separated list of feature names or numeric values follows the
66operation.
67.El
68.Pp
69If
70.Fl e
71is not specified
72.Nm
73displays the status of each feature in the ELF note in each
74.Ar .
75.Sh EXIT STATUS
76Exit status is 0 on success, and 1 if the command
77fails if a file does not exist, is too short,
78or fails to find or edit features note.
79.Sh EXAMPLES
80The following is an example of a typical usage
81of the
82.Nm
83command:
84.Bd -literal -offset indent
85elfctl file
86elfctl -e +noaslr file
87.Ed
88.Pp
89Features may be specified as numerical values:
90.Bd -literal -offset -indent
91elfctl -e =0x0001,0x0004 file
92.Ed
93.Pp
94Features may also be specified as a single combined value:
95.Bd -literal -offset -indent
96elfctl -e =0x5 file
97.Ed
98.Sh SEE ALSO
99.Xr mitigations 7
100.Sh HISTORY
101.Nm
102first appeared in
103.Fx 12.2 .
104.Sh AUTHORS
105.Nm
106was written by
107.An Bora Ozarslan Mt borako.ozarslan@gmail.com
108under sponsorship from the
109.Fx Foundation.
110