blob: a53ec6f7623fd2c59455b605a375412d9c94f624 [file] [log] [blame]
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -08001.TH MINIJAIL0 "1" "March 2016" "Chromium OS" "User Commands"
Elly Jonescd7a9042011-07-22 13:56:51 -04002.SH NAME
3minijail0 \- sandbox a process
4.SH SYNOPSIS
5.B minijail0
Jorge Lucangeli Obes13650612016-09-02 11:27:29 -04006[\fIOPTION\fR]... <\fIPROGRAM\fR> [\fIargs\fR]...
Elly Jonescd7a9042011-07-22 13:56:51 -04007.SH DESCRIPTION
8.PP
9Runs PROGRAM inside a sandbox.
10.TP
Andrew Brestickereac28942015-11-11 16:04:46 -080011\fB-a <table>\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -080012Run using the alternate syscall table named \fItable\fR. Only available on kernels
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -040013and architectures that support the \fBPR_ALT_SYSCALL\fR option of \fBprctl\fR(2).
Andrew Brestickereac28942015-11-11 16:04:46 -080014.TP
Zi Lin44461c72021-11-16 18:37:27 +000015\fB-b <src>[,[dest][,<writeable>]]\fR, \fB--bind-mount=<src>[,[dest][,<writeable>]]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -080016Bind-mount \fIsrc\fR into the chroot directory at \fIdest\fR, optionally writeable.
Mike Frysingereaab4202017-08-14 14:57:21 -040017The \fIsrc\fR path must be an absolute path.
Mike Frysingerc9b07992020-09-01 05:04:48 -040018
Mike Frysinger8f0665b2018-01-17 14:26:09 -050019If \fIdest\fR is not specified, it will default to \fIsrc\fR.
Mike Frysingereaab4202017-08-14 14:57:21 -040020If the destination does not exist, it will be created as a file or directory
Mike Frysinger5fdba4e2018-01-17 15:39:48 -050021based on the \fIsrc\fR type (including missing parent directories).
Mike Frysingerc9b07992020-09-01 05:04:48 -040022
David Coles87ec5cd2019-06-13 17:20:10 -070023To create a writable bind-mount set \fIwritable\fR to \fB1\fR. If not specified
24it will default to \fB0\fR (read-only).
Elly Jones51a5b6c2011-10-12 19:09:26 -040025.TP
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070026\fB-B <mask>\fR
27Skip setting securebits in \fImask\fR when restricting capabilities (\fB-c\fR).
28\fImask\fR is a hex constant that represents the mask of securebits that will
29be preserved. See \fBcapabilities\fR(7) for the complete list. By default,
30\fBSECURE_NOROOT\fR, \fBSECURE_NO_SETUID_FIXUP\fR, and \fBSECURE_KEEP_CAPS\fR
31(together with their respective locks) are set.
32\fBSECBIT_NO_CAP_AMBIENT_RAISE\fR (and its respective lock) is never set
33because the permitted and inheritable capability sets have already been set
34through \fB-c\fR.
35.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040036\fB-c <caps>\fR
Luis Hector Chavezdabc4302018-09-21 09:21:47 -070037Restrict capabilities to \fIcaps\fR, which is either a hex constant or a string
38that will be passed to \fBcap_from_text\fR(3) (only the effective capability
39mask will be considered). The value will be used as the permitted, effective,
40and inheritable sets. When used in conjunction with \fB-u\fR and \fB-g\fR,
41this allows a program to have access to only certain parts of root's default
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070042privileges while running as another user and group ID altogether. Note that
43these capabilities are not inherited by subprocesses of the process given
44capabilities unless those subprocesses have POSIX file capabilities or the
45\fB--ambient\fR flag is also passed. See \fBcapabilities\fR(7).
Elly Jonescd7a9042011-07-22 13:56:51 -040046.TP
Dylan Reid6cae0b22015-11-18 18:47:49 -080047\fB-C <dir>\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -040048Change root (using \fBchroot\fR(2)) to \fIdir\fR.
Dylan Reid6cae0b22015-11-18 18:47:49 -080049.TP
Mike Frysinger33ffef32017-01-13 19:53:19 -050050\fB-d\fR, \fB--mount-dev\fR
51Create a new /dev mount with a minimal set of nodes. Implies \fB-v\fR.
52Additional nodes can be bound with the \fB-b\fR or \fB-k\fR options.
Mike Frysinger604cc7b2020-12-29 18:18:56 -050053
54.nf
55\[bu] The initial set of nodes are: full null tty urandom zero.
56\[bu] Symlinks are also created for: fd ptmx stderr stdin stdout.
57\[bu] Directores are also created for: shm.
58.re
Mike Frysinger33ffef32017-01-13 19:53:19 -050059.TP
Dylan Reid6cae0b22015-11-18 18:47:49 -080060\fB-e[file]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -080061Enter a new network namespace, or if \fIfile\fR is specified, enter an existing
Dylan Reid6cae0b22015-11-18 18:47:49 -080062network namespace specified by \fIfile\fR which is typically of the form
63/proc/<pid>/ns/net.
64.TP
65\fB-f <file>\fR
66Write the pid of the jailed process to \fIfile\fR.
67.TP
Stéphane Lesimple8d7174b2020-02-07 20:51:08 +010068\fB-g <group|gid>
69Change groups to the specified \fIgroup\fR name, or numeric group ID \fIgid\fR.
Lutz Justen13807cb2017-01-03 17:11:55 +010070.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040071\fB-G\fR
72Inherit all the supplementary groups of the user specified with \fB-u\fR. It
73is an error to use this option without having specified a \fBuser name\fR to
74\fB-u\fR.
75.TP
Stéphane Lesimple8d7174b2020-02-07 20:51:08 +010076\fB--add-suppl-group <group|gid>\fR
77Add the specified \fIgroup\fR name, or numeric group ID \fIgid\fR,
78to the process' supplementary groups list. Can be specified
79multiple times to add several groups. Incompatible with -y and -G.
80.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040081\fB-h\fR
82Print a help message.
83.TP
Will Drewry32ac9f52011-08-18 21:36:27 -050084\fB-H\fR
85Print a help message detailing supported system call names for seccomp_filter.
86(Other direct numbers may be specified if minijail0 is not in sync with the
Mike Frysinger4a5fed62018-01-17 16:04:50 -050087host kernel or something like 32/64-bit compatibility issues exist.)
Will Drewry32ac9f52011-08-18 21:36:27 -050088.TP
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070089\fB-i\fR
90Exit immediately after \fBfork\fR(2). The jailed process will keep running in
91the background.
Mike Frysinger69357a52018-09-29 03:15:30 -040092
93Normally minijail will fork+exec the specified \fIprogram\fR so that it can set
94up the right security settings in the new child process. The initial minijail
95process will stay resident and wait for the \fIprogram\fR to exit so the script
96that ran minijail will correctly block (e.g. standalone scripts). Specifying
97\fB-i\fR makes that initial process exit immediately and free up the resources.
98
99This option is recommended for daemons and init services when you want to
100background the long running \fIprogram\fR.
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -0700101.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700102\fB-I\fR
103Run \fIprogram\fR as init (pid 1) inside a new pid namespace (implies \fB-p\fR).
Mike Frysinger69357a52018-09-29 03:15:30 -0400104
105Most programs don't expect to run as an init which is why minijail will do it
106for you by default. Basically, the \fIprogram\fR needs to reap any processes it
107forks to avoid leaving zombies behind. Signal handling needs care since the
108kernel will mask all signals that don't have handlers registered (all default
109handlers are ignored and cannot be changed).
110
111This means a minijail process (acting as init) will remain resident by default.
112While using \fB-I\fR is recommended when possible, strict review is required to
113make sure the \fIprogram\fR continues to work as expected.
114
115\fB-i\fR and \fB-I\fR may be safely used together. The \fB-i\fR option controls
116the first minijail process outside of the pid namespace while the \fB-I\fR
117option controls the minijail process inside of the pid namespace.
Brian Norris3b5841b2016-03-16 16:43:49 -0700118.TP
Zi Lin44461c72021-11-16 18:37:27 +0000119\fB-k <src>,<dest>,<type>[,<flags>[,<data>]]\fR, \fB--mount=<src>,<dest>,<type>[,<flags>[,<data>]]\fR
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500120Mount \fIsrc\fR, a \fItype\fR filesystem, at \fIdest\fR. If a chroot or pivot
121root is active, \fIdest\fR will automatically be placed below that path.
122
Mike Frysinger6f4e93d2018-05-23 05:05:35 -0400123The \fIflags\fR field is optional and may be a mix of \fIMS_XXX\fR or hex
124constants separated by \fI|\fR characters. See \fBmount\fR(2) for details.
Mike Frysingercb8674d2018-08-12 00:53:35 -0400125\fIMS_NODEV|MS_NOSUID|MS_NOEXEC\fR is the default value (a writable mount
Mike Frysinger6f4e93d2018-05-23 05:05:35 -0400126with nodev/nosuid/noexec bits set), and it is strongly recommended that all
Mike Frysingercb8674d2018-08-12 00:53:35 -0400127mounts have these three bits set whenever possible. If you need to disable
128all three, then specify something like \fIMS_SILENT\fR.
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500129
130The \fIdata\fR field is optional and is a comma delimited string (see
131\fBmount\fR(2) for details). It is passed directly to the kernel, so all
Mike Frysingerb7803c82018-08-23 15:43:15 -0400132fields here are filesystem specific. For \fItmpfs\fR, if no data is specified,
133we will default to \fImode=0755,size=10M\fR. If you want other settings, you
134will need to specify them explicitly yourself.
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500135
Mike Frysingereaab4202017-08-14 14:57:21 -0400136If the mount is not a pseudo filesystem (e.g. proc or sysfs), \fIsrc\fR path
137must be an absolute path (e.g. \fI/dev/sda1\fR and not \fIsda1\fR).
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500138
Mike Frysinger5fdba4e2018-01-17 15:39:48 -0500139If the destination does not exist, it will be created as a directory (including
140missing parent directories).
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800141.TP
Mike Frysinger785b1c32018-02-23 15:47:24 -0500142\fB-K[mode]\fR
Jorge Lucangeli Obes9e1ac372020-01-23 14:36:50 -0500143Don't mark all existing mounts as MS_SLAVE.
Nicole Anderson-Auafa54be2021-03-09 23:00:49 +0000144This option is \fBdangerous\fR as it negates most of the functionality of \fB-v\fR.
145You very likely don't need this.
Mike Frysinger785b1c32018-02-23 15:47:24 -0500146
Nicole Anderson-Auafa54be2021-03-09 23:00:49 +0000147You may specify a mount propagation mode in which case, that will be used
148instead of the default MS_SLAVE. See the \fBmount\fR(2) man page and the
Mike Frysinger785b1c32018-02-23 15:47:24 -0500149kernel docs \fIDocumentation/filesystems/sharedsubtree.txt\fR for more
150technical details, but a brief guide:
151
152.IP
153\[bu] \fBslave\fR Changes in the parent mount namespace will propagate in, but
154changes in this mount namespace will not propagate back out. This is usually
Jorge Lucangeli Obes9e1ac372020-01-23 14:36:50 -0500155what people want to use, and is the default behavior if you don't specify \fB-K\fR.
Mike Frysinger785b1c32018-02-23 15:47:24 -0500156.IP
157\[bu] \fBprivate\fR No changes in either mount namespace will propagate.
Jorge Lucangeli Obes9e1ac372020-01-23 14:36:50 -0500158This provides the most isolation.
Mike Frysinger785b1c32018-02-23 15:47:24 -0500159.IP
160\[bu] \fBshared\fR Changes in the parent and this mount namespace will freely
161propagate back and forth. This is not recommended.
162.IP
163\[bu] \fBunbindable\fR Mark all mounts as unbindable.
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800164.TP
Dylan Reidf7942472015-11-18 17:55:26 -0800165\fB-l\fR
166Run inside a new IPC namespace. This option makes the program's System V IPC
167namespace independent.
168.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700169\fB-L\fR
Jorge Lucangeli Obes32201f82019-06-12 14:45:06 -0400170Report blocked syscalls when using a seccomp filter. On kernels with support for
171SECCOMP_RET_LOG, every blocked syscall will be reported through the audit
172subsystem (see \fBseccomp\fR(2) for more details on SECCOMP_RET_LOG
173availability.) On all other kernels, the first failing syscall will be logged to
174syslog. This latter case will also force certain syscalls to be allowed in order
175to write to syslog. Note: this option is disabled and ignored for release
176builds.
Brian Norris3b5841b2016-03-16 16:43:49 -0700177.TP
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500178\fB-m[<uid> <loweruid> <count>[,<uid> <loweruid> <count>]]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800179Set the uid mapping of a user namespace (implies \fB-pU\fR). Same arguments as
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400180\fBnewuidmap\fR(1). Multiple mappings should be separated by ','. With no mapping,
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500181map the current uid to root inside the user namespace.
Dylan Reid6cae0b22015-11-18 18:47:49 -0800182.TP
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500183\fB-M[<uid> <loweruid> <count>[,<uid> <loweruid> <count>]]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800184Set the gid mapping of a user namespace (implies \fB-pU\fR). Same arguments as
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400185\fBnewgidmap\fR(1). Multiple mappings should be separated by ','. With no mapping,
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500186map the current gid to root inside the user namespace.
Dylan Reid6cae0b22015-11-18 18:47:49 -0800187.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700188\fB-n\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400189Set the process's \fIno_new_privs\fR bit. See \fBprctl\fR(2) and the kernel
Brian Norris3b5841b2016-03-16 16:43:49 -0700190source file \fIDocumentation/prctl/no_new_privs.txt\fR for more info.
191.TP
Dylan Reid87e58512016-07-11 14:35:12 -0700192\fB-N\fR
193Run inside a new cgroup namespace. This option runs the program with a cgroup
194view showing the program's cgroup as the root. This is only available on v4.6+
195of the Linux kernel.
196.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400197\fB-p\fR
198Run inside a new PID namespace. This option will make it impossible for the
Elly Jonese58176c2012-01-23 11:46:17 -0500199program to see or affect processes that are not its descendants. This implies
200\fB-v\fR and \fB-r\fR, since otherwise the process can see outside its namespace
201by inspecting /proc.
Mike Frysinger69357a52018-09-29 03:15:30 -0400202
203If the \fIprogram\fR exits, all of its children will be killed immediately by
204the kernel. If you need to daemonize or background things, use the \fB-i\fR
205option.
206
207See \fBpid_namespaces\fR(7) for more info.
Elly Jonescd7a9042011-07-22 13:56:51 -0400208.TP
Dylan Reid6cae0b22015-11-18 18:47:49 -0800209\fB-P <dir>\fR
210Set \fIdir\fR as the root fs using \fBpivot_root\fR. Implies \fB-v\fR, not
211compatible with \fB-C\fR.
212.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400213\fB-r\fR
Dylan Reid6cae0b22015-11-18 18:47:49 -0800214Remount /proc readonly. This implies \fB-v\fR. Remounting /proc readonly means
215that even if the process has write access to a system config knob in /proc
216(e.g., in /sys/kernel), it cannot change the value.
Elly Jonescd7a9042011-07-22 13:56:51 -0400217.TP
Luis Hector Chavez7058a2d2018-01-29 08:41:34 -0800218\fB-R <rlim_type>,<rlim_cur>,<rlim_max>\fR
Mike Frysingere34d7fe2018-05-23 04:18:30 -0400219Set an rlimit value, see \fBgetrlimit\fR(2) for more details.
220
221\fIrlim_type\fR may be specified using symbolic constants like \fIRLIMIT_AS\fR.
222
223\fIrlim_cur\fR and \fIrlim_max\fR are specified either with a number (decimal or
224hex starting with \fI0x\fR), or with the string \fIunlimited\fR (which will
225translate to \fIRLIM_INFINITY\fR).
Dylan Reid0f72ef42017-06-06 15:42:49 -0700226.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400227\fB-s\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400228Enable \fBseccomp\fR(2) in mode 1, which restricts the child process to a very
229small set of system calls.
Mike Frysingere61fd662017-06-20 14:07:41 -0400230You most likely do not want to use this with the seccomp filter mode (\fB-S\fR)
231as they are completely different (even though they have similar names).
Will Drewry32ac9f52011-08-18 21:36:27 -0500232.TP
233\fB-S <arch-specific seccomp_filter policy file>\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400234Enable \fBseccomp\fR(2) in mode 13 which restricts the child process to a set of
Luis Hector Chavezc3e17722018-10-16 20:43:12 -0700235system calls defined in the policy file. Note that system call names may be
236different based on the runtime environment; see \fBminijail0\fR(5) for more
237details.
Elly Jonescd7a9042011-07-22 13:56:51 -0400238.TP
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500239\fB-t[size]\fR
Mike Frysingerec7def22017-01-13 18:44:45 -0500240Mounts a tmpfs filesystem on /tmp. /tmp must exist already (e.g. in the chroot).
Martin Pelikánab9eb442017-01-25 11:53:58 +1100241The filesystem has a default size of "64M", overridden with an optional
242argument. It has standard /tmp permissions (1777), and is mounted
243nodev/noexec/nosuid. Implies \fB-v\fR.
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800244.TP
Matthew Dempsky2ed09122016-02-11 09:43:37 -0800245\fB-T <type>\fR
Graziano Misuraca58602a82017-08-28 17:33:15 -0700246Assume binary's ELF linkage type is \fItype\fR, which must be either 'static'
247or 'dynamic'. Either setting will prevent minijail0 from manually parsing the
248ELF header to determine the type. Type 'static' can be used to avoid preload
249hooking, and will force minijail0 to instead set everything up before the
250program is executed. Type 'dynamic' will force minijail0 to preload
251\fIlibminijailpreload.so\fR to setup hooks, but will fail on actually
252statically-linked binaries.
Matthew Dempsky2ed09122016-02-11 09:43:37 -0800253.TP
Stéphane Lesimple8d7174b2020-02-07 20:51:08 +0100254\fB-u <user|uid>\fR
255Change users to the specified \fIuser\fR name, or numeric user ID \fIuid\fR.
Elly Jonescd7a9042011-07-22 13:56:51 -0400256.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700257\fB-U\fR
258Enter a new user namespace (implies \fB-p\fR).
259.TP
Zi Linc6289102022-01-28 23:38:32 +0000260\fB-v\fR, \fB--ns-mount\fR
Jorge Lucangeli Obes9e1ac372020-01-23 14:36:50 -0500261Run inside a new VFS namespace. This option prevents mounts performed by the
262program from affecting the rest of the system (but see \fB-K\fR).
Dylan Reid6cae0b22015-11-18 18:47:49 -0800263.TP
264\fB-V <file>\fR
265Enter the VFS namespace specified by \fIfile\fR.
Jorge Lucangeli Obes13650612016-09-02 11:27:29 -0400266.TP
Chirantan Ekbote866bb3a2017-02-07 12:26:42 -0800267\fB-w\fR
268Create and join a new anonymous session keyring. See \fBkeyrings\fR(7) for more
269details.
270.TP
Lutz Justen13807cb2017-01-03 17:11:55 +0100271\fB-y\fR
272Keep the current user's supplementary groups.
273.TP
Jorge Lucangeli Obes13650612016-09-02 11:27:29 -0400274\fB-Y\fR
275Synchronize seccomp filters across thread group.
Mike Frysingerb9a7b162017-05-30 15:25:49 -0400276.TP
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -0700277\fB-z\fR
278Don't forward any signals to the jailed process. For example, when not using
279\fB-i\fR, sending \fBSIGINT\fR (e.g., CTRL-C on the terminal), will kill the
280minijail0 process, not the jailed process.
281.TP
282\fB--ambient\fR
283Raise ambient capabilities to match the mask specified by \fB-c\fR. Since
284ambient capabilities are preserved across \fBexecve\fR(2), this allows for
285process trees to have a restricted set of capabilities, even if they are
286capability-dumb binaries. See \fBcapabilities\fR(7).
287.TP
Mike Frysingerb9a7b162017-05-30 15:25:49 -0400288\fB--uts[=hostname]\fR
289Create a new UTS/hostname namespace, and optionally set the hostname in the new
290namespace to \fIhostname\fR.
Luis Hector Chavez114a9302017-09-05 20:36:58 -0700291.TP
Stéphane Lesimplef65da3a2022-01-11 11:44:47 +0100292\fB--env-reset\fR
293Clear the current environment instead of having the program inherit the active
294environment. This is often used to start the program with a minimal
295sanitized environment.
296.TP
297\fB--env-add <NAME=value>\fR
298Adds or replace the specified environment variable \fINAME\fR in the program's
299environment before starting it, and set it to the specified \fIvalue\fR.
300This option can be used several times to set any number of environment variables.
301.TP
Luis Hector Chavez114a9302017-09-05 20:36:58 -0700302\fB--logging=<system>\fR
303Use \fIsystem\fR as the logging system. \fIsystem\fR must be one of
Mike Frysinger3e6a12c2019-09-24 12:50:55 -0400304\fBauto\fR (the default), \fBsyslog\fR, or \fBstderr\fR.
305
306\fBauto\fR will use \fBstderr\fR if connected to a tty (e.g. run directly by a
307user), otherwise it will use \fBsyslog\fR.
Luis Hector Chavezd45fc422017-10-25 15:11:53 -0700308.TP
309\fB--profile <profile>\fR
310Choose from one of the available sandboxing profiles, which are simple way to
311get a standardized environment. See the
312.BR "SANDBOXING PROFILES"
313section below for the full list of supported values for \fIprofile\fR.
Luis Hector Chavez9acba452018-10-11 10:13:25 -0700314.TP
315\fB--preload-library <file path>\fR
316Allows overriding the default path of \fI/lib/libminijailpreload.so\fR. This
317is only really useful for testing.
Luis Hector Chavezc3e17722018-10-16 20:43:12 -0700318\fB--seccomp-bpf-binary <arch-specific BPF binary>\fR
319This is similar to \fB-S\fR, but
320instead of using a policy file, \fB--secomp-bpf-binary\fR expects a
321arch-and-kernel-version-specific pre-compiled BPF binary (such as the ones
322produced by \fBparse_seccomp_policy\fR). Note that the filter might be
323different based on the runtime environment; see \fBminijail0\fR(5) for more
324details.
Anand K Mistry31adc6c2020-11-26 11:39:46 +1100325.TP
326\fB--allow-speculative-execution\fR
327Allow speculative execution features that may cause data leaks across processes.
328This passes the \fISECCOMP_FILTER_FLAG_SPEC_ALLOW\fR flag to seccomp which
329disables mitigations against certain speculative execution attacks; namely
330Branch Target Injection (spectre-v2) and Speculative Store Bypass (spectre-v4).
331These mitigations incur a runtime performance hit, so it is useful to be able
332to disable them in order to quantify their performance impact.
333
334\fBWARNING:\fR It is dangerous to use this option on programs that process
335untrusted input, which is normally what Minijail is used for. Do not enable
336this option unless you know what you're doing.
337
338See the kernel documentation \fIDocumentation/userspace-api/spec_ctrl.rst\fR
339and \fIDocumentation/admin-guide/hw-vuln/spectre.rst\fR for more information.
Zi Lin44461c72021-11-16 18:37:27 +0000340.TP
341\fB--config <file path>\fR
342Use a Minijail configuration file to set options, through
343commandline-option-equivalent key-value pairs.
344See \fBminijail0\fR(5) for more details on the format of the configuration file.
Luis Hector Chavezd45fc422017-10-25 15:11:53 -0700345.SH SANDBOXING PROFILES
346The following sandboxing profiles are supported:
347.TP
348\fBminimalistic-mountns\fR
349Set up a minimalistic mount namespace. Equivalent to \fB-v -P /var/empty
Jorge Lucangeli Obes7394b902019-03-14 12:43:26 -0400350-b / -b /proc -b /dev/log -t -r --mount-dev\fR.
Mike Frysingercc5917c2020-02-03 12:34:14 -0500351.TP
352\fBminimalistic-mountns-nodev\fR
353Set up a minimalistic mount namespace with an empty /dev path. Equivalent to
354\fB-v -P /var/empty -b/ -b/proc -t -r\fR.
Elly Jonescd7a9042011-07-22 13:56:51 -0400355.SH IMPLEMENTATION
356This program is broken up into two parts: \fBminijail0\fR (the frontend) and a helper
Luis Hector Chavez689deb72018-09-27 23:39:21 -0700357library called \fBlibminijailpreload\fR. Some jailings can only be achieved
358from the process to which they will actually apply:
359
360.IP
361\[bu] capability use (without using ambient capabilities): non-ambient
362capabilities are not inherited across \fBexecve\fR(2) unless the file being
363executed has POSIX file capabilities. Ambient capabilities (the
364\fB--ambient\fR flag) fix capability inheritance across \fBexecve\fR(2) to
365avoid the need for file capabilities.
366
367\[bu] seccomp: a meaningful seccomp filter policy should disallow
368\fBexecve\fR(2), to prevent a compromised process from executing a different
369binary. However, this would prevent the seccomp policy from being applied
370before \fBexecve\fR(2).
371.RE
Elly Jonescd7a9042011-07-22 13:56:51 -0400372
373To this end, \fBlibminijailpreload\fR is forcibly loaded into all
Luis Hector Chavez689deb72018-09-27 23:39:21 -0700374dynamically-linked target programs by default; we pass the specific
375restrictions in an environment variable which the preloaded library looks for.
376The forcibly-loaded library then applies the restrictions to the newly-loaded
377program.
378
379This behavior can be disabled by the use of the \fB-T static\fR flag. There
380are other cases in which the use of this flag might be useful:
381
382.IP
383\[bu] When \fIprogram\fR is linked against a different version of \fBlibc.so\fR
384than \fBlibminijailpreload.so\fR.
385
386\[bu] When \fBexecve\fR(2) has side-effects that interact badly with the
387jailing process. If the system uses SELinux, \fBexecve\fR(2) can cause an
388automatic domain transition, which would then require that the target domain
389allows the operations to jail \fIprogram\fR.
390.RE
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800391
Elly Jonescd7a9042011-07-22 13:56:51 -0400392.SH AUTHOR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800393The Chromium OS Authors <chromiumos-dev@chromium.org>
Elly Jonescd7a9042011-07-22 13:56:51 -0400394.SH COPYRIGHT
395Copyright \(co 2011 The Chromium OS Authors
396License BSD-like.
397.SH "SEE ALSO"
Mike Frysinger5a6bb502020-01-25 04:04:41 -0500398.BR libminijail.h ,
399.BR minijail0 (5),
400.BR seccomp (2)