blob: 820d3ca054fe3446c0324c6f22e184f5133421d8 [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
Mike Frysinger8f0665b2018-01-17 14:26:09 -050015\fB-b <src>[,<dest>[,<writeable>]]
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 Frysinger8f0665b2018-01-17 14:26:09 -050018If \fIdest\fR is not specified, it will default to \fIsrc\fR.
Mike Frysingereaab4202017-08-14 14:57:21 -040019If the destination does not exist, it will be created as a file or directory
Mike Frysinger5fdba4e2018-01-17 15:39:48 -050020based on the \fIsrc\fR type (including missing parent directories).
David Coles87ec5cd2019-06-13 17:20:10 -070021To create a writable bind-mount set \fIwritable\fR to \fB1\fR. If not specified
22it will default to \fB0\fR (read-only).
Elly Jones51a5b6c2011-10-12 19:09:26 -040023.TP
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070024\fB-B <mask>\fR
25Skip setting securebits in \fImask\fR when restricting capabilities (\fB-c\fR).
26\fImask\fR is a hex constant that represents the mask of securebits that will
27be preserved. See \fBcapabilities\fR(7) for the complete list. By default,
28\fBSECURE_NOROOT\fR, \fBSECURE_NO_SETUID_FIXUP\fR, and \fBSECURE_KEEP_CAPS\fR
29(together with their respective locks) are set.
30\fBSECBIT_NO_CAP_AMBIENT_RAISE\fR (and its respective lock) is never set
31because the permitted and inheritable capability sets have already been set
32through \fB-c\fR.
33.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040034\fB-c <caps>\fR
Luis Hector Chavezdabc4302018-09-21 09:21:47 -070035Restrict capabilities to \fIcaps\fR, which is either a hex constant or a string
36that will be passed to \fBcap_from_text\fR(3) (only the effective capability
37mask will be considered). The value will be used as the permitted, effective,
38and inheritable sets. When used in conjunction with \fB-u\fR and \fB-g\fR,
39this allows a program to have access to only certain parts of root's default
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070040privileges while running as another user and group ID altogether. Note that
41these capabilities are not inherited by subprocesses of the process given
42capabilities unless those subprocesses have POSIX file capabilities or the
43\fB--ambient\fR flag is also passed. See \fBcapabilities\fR(7).
Elly Jonescd7a9042011-07-22 13:56:51 -040044.TP
Dylan Reid6cae0b22015-11-18 18:47:49 -080045\fB-C <dir>\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -040046Change root (using \fBchroot\fR(2)) to \fIdir\fR.
Dylan Reid6cae0b22015-11-18 18:47:49 -080047.TP
Mike Frysinger33ffef32017-01-13 19:53:19 -050048\fB-d\fR, \fB--mount-dev\fR
49Create a new /dev mount with a minimal set of nodes. Implies \fB-v\fR.
50Additional nodes can be bound with the \fB-b\fR or \fB-k\fR options.
51The initial set of nodes are: full null tty urandom zero.
52Symlinks are also created for: fd ptmx stderr stdin stdout.
53.TP
Dylan Reid6cae0b22015-11-18 18:47:49 -080054\fB-e[file]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -080055Enter a new network namespace, or if \fIfile\fR is specified, enter an existing
Dylan Reid6cae0b22015-11-18 18:47:49 -080056network namespace specified by \fIfile\fR which is typically of the form
57/proc/<pid>/ns/net.
58.TP
59\fB-f <file>\fR
60Write the pid of the jailed process to \fIfile\fR.
61.TP
Stéphane Lesimple8d7174b2020-02-07 20:51:08 +010062\fB-g <group|gid>
63Change groups to the specified \fIgroup\fR name, or numeric group ID \fIgid\fR.
Lutz Justen13807cb2017-01-03 17:11:55 +010064.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040065\fB-G\fR
66Inherit all the supplementary groups of the user specified with \fB-u\fR. It
67is an error to use this option without having specified a \fBuser name\fR to
68\fB-u\fR.
69.TP
Stéphane Lesimple8d7174b2020-02-07 20:51:08 +010070\fB--add-suppl-group <group|gid>\fR
71Add the specified \fIgroup\fR name, or numeric group ID \fIgid\fR,
72to the process' supplementary groups list. Can be specified
73multiple times to add several groups. Incompatible with -y and -G.
74.TP
Elly Jonescd7a9042011-07-22 13:56:51 -040075\fB-h\fR
76Print a help message.
77.TP
Will Drewry32ac9f52011-08-18 21:36:27 -050078\fB-H\fR
79Print a help message detailing supported system call names for seccomp_filter.
80(Other direct numbers may be specified if minijail0 is not in sync with the
Mike Frysinger4a5fed62018-01-17 16:04:50 -050081host kernel or something like 32/64-bit compatibility issues exist.)
Will Drewry32ac9f52011-08-18 21:36:27 -050082.TP
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070083\fB-i\fR
84Exit immediately after \fBfork\fR(2). The jailed process will keep running in
85the background.
Mike Frysinger69357a52018-09-29 03:15:30 -040086
87Normally minijail will fork+exec the specified \fIprogram\fR so that it can set
88up the right security settings in the new child process. The initial minijail
89process will stay resident and wait for the \fIprogram\fR to exit so the script
90that ran minijail will correctly block (e.g. standalone scripts). Specifying
91\fB-i\fR makes that initial process exit immediately and free up the resources.
92
93This option is recommended for daemons and init services when you want to
94background the long running \fIprogram\fR.
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -070095.TP
Brian Norris3b5841b2016-03-16 16:43:49 -070096\fB-I\fR
97Run \fIprogram\fR as init (pid 1) inside a new pid namespace (implies \fB-p\fR).
Mike Frysinger69357a52018-09-29 03:15:30 -040098
99Most programs don't expect to run as an init which is why minijail will do it
100for you by default. Basically, the \fIprogram\fR needs to reap any processes it
101forks to avoid leaving zombies behind. Signal handling needs care since the
102kernel will mask all signals that don't have handlers registered (all default
103handlers are ignored and cannot be changed).
104
105This means a minijail process (acting as init) will remain resident by default.
106While using \fB-I\fR is recommended when possible, strict review is required to
107make sure the \fIprogram\fR continues to work as expected.
108
109\fB-i\fR and \fB-I\fR may be safely used together. The \fB-i\fR option controls
110the first minijail process outside of the pid namespace while the \fB-I\fR
111option controls the minijail process inside of the pid namespace.
Brian Norris3b5841b2016-03-16 16:43:49 -0700112.TP
Mike Frysingerfea05c62018-01-17 16:56:48 -0500113\fB-k <src>,<dest>,<type>[,<flags>[,<data>]]\fR
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500114Mount \fIsrc\fR, a \fItype\fR filesystem, at \fIdest\fR. If a chroot or pivot
115root is active, \fIdest\fR will automatically be placed below that path.
116
Mike Frysinger6f4e93d2018-05-23 05:05:35 -0400117The \fIflags\fR field is optional and may be a mix of \fIMS_XXX\fR or hex
118constants separated by \fI|\fR characters. See \fBmount\fR(2) for details.
Mike Frysingercb8674d2018-08-12 00:53:35 -0400119\fIMS_NODEV|MS_NOSUID|MS_NOEXEC\fR is the default value (a writable mount
Mike Frysinger6f4e93d2018-05-23 05:05:35 -0400120with nodev/nosuid/noexec bits set), and it is strongly recommended that all
Mike Frysingercb8674d2018-08-12 00:53:35 -0400121mounts have these three bits set whenever possible. If you need to disable
122all three, then specify something like \fIMS_SILENT\fR.
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500123
124The \fIdata\fR field is optional and is a comma delimited string (see
125\fBmount\fR(2) for details). It is passed directly to the kernel, so all
Mike Frysingerb7803c82018-08-23 15:43:15 -0400126fields here are filesystem specific. For \fItmpfs\fR, if no data is specified,
127we will default to \fImode=0755,size=10M\fR. If you want other settings, you
128will need to specify them explicitly yourself.
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500129
Mike Frysingereaab4202017-08-14 14:57:21 -0400130If the mount is not a pseudo filesystem (e.g. proc or sysfs), \fIsrc\fR path
131must be an absolute path (e.g. \fI/dev/sda1\fR and not \fIsda1\fR).
Mike Frysinger4f3e09f2018-01-24 18:01:16 -0500132
Mike Frysinger5fdba4e2018-01-17 15:39:48 -0500133If the destination does not exist, it will be created as a directory (including
134missing parent directories).
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800135.TP
Mike Frysinger785b1c32018-02-23 15:47:24 -0500136\fB-K[mode]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800137Don't mark all existing mounts as MS_PRIVATE.
138This option is \fBdangerous\fR as it negates most of the functionality of \fB-v\fR.
139You very likely don't need this.
Mike Frysinger785b1c32018-02-23 15:47:24 -0500140
141You may specify a mount propagation mode in which case, that will be used
142instead of the default MS_PRIVATE. See the \fBmount\fR(2) man page and the
143kernel docs \fIDocumentation/filesystems/sharedsubtree.txt\fR for more
144technical details, but a brief guide:
145
146.IP
147\[bu] \fBslave\fR Changes in the parent mount namespace will propagate in, but
148changes in this mount namespace will not propagate back out. This is usually
149what people want to use.
150.IP
151\[bu] \fBprivate\fR No changes in either mount namespace will propagate.
152This is the default behavior if you don't specify \fB-K\fR.
153.IP
154\[bu] \fBshared\fR Changes in the parent and this mount namespace will freely
155propagate back and forth. This is not recommended.
156.IP
157\[bu] \fBunbindable\fR Mark all mounts as unbindable.
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800158.TP
Dylan Reidf7942472015-11-18 17:55:26 -0800159\fB-l\fR
160Run inside a new IPC namespace. This option makes the program's System V IPC
161namespace independent.
162.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700163\fB-L\fR
Jorge Lucangeli Obes32201f82019-06-12 14:45:06 -0400164Report blocked syscalls when using a seccomp filter. On kernels with support for
165SECCOMP_RET_LOG, every blocked syscall will be reported through the audit
166subsystem (see \fBseccomp\fR(2) for more details on SECCOMP_RET_LOG
167availability.) On all other kernels, the first failing syscall will be logged to
168syslog. This latter case will also force certain syscalls to be allowed in order
169to write to syslog. Note: this option is disabled and ignored for release
170builds.
Brian Norris3b5841b2016-03-16 16:43:49 -0700171.TP
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500172\fB-m[<uid> <loweruid> <count>[,<uid> <loweruid> <count>]]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800173Set the uid mapping of a user namespace (implies \fB-pU\fR). Same arguments as
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400174\fBnewuidmap\fR(1). Multiple mappings should be separated by ','. With no mapping,
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500175map the current uid to root inside the user namespace.
Dylan Reid6cae0b22015-11-18 18:47:49 -0800176.TP
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500177\fB-M[<uid> <loweruid> <count>[,<uid> <loweruid> <count>]]\fR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800178Set the gid mapping of a user namespace (implies \fB-pU\fR). Same arguments as
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400179\fBnewgidmap\fR(1). Multiple mappings should be separated by ','. With no mapping,
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500180map the current gid to root inside the user namespace.
Dylan Reid6cae0b22015-11-18 18:47:49 -0800181.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700182\fB-n\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400183Set the process's \fIno_new_privs\fR bit. See \fBprctl\fR(2) and the kernel
Brian Norris3b5841b2016-03-16 16:43:49 -0700184source file \fIDocumentation/prctl/no_new_privs.txt\fR for more info.
185.TP
Dylan Reid87e58512016-07-11 14:35:12 -0700186\fB-N\fR
187Run inside a new cgroup namespace. This option runs the program with a cgroup
188view showing the program's cgroup as the root. This is only available on v4.6+
189of the Linux kernel.
190.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400191\fB-p\fR
192Run inside a new PID namespace. This option will make it impossible for the
Elly Jonese58176c2012-01-23 11:46:17 -0500193program to see or affect processes that are not its descendants. This implies
194\fB-v\fR and \fB-r\fR, since otherwise the process can see outside its namespace
195by inspecting /proc.
Mike Frysinger69357a52018-09-29 03:15:30 -0400196
197If the \fIprogram\fR exits, all of its children will be killed immediately by
198the kernel. If you need to daemonize or background things, use the \fB-i\fR
199option.
200
201See \fBpid_namespaces\fR(7) for more info.
Elly Jonescd7a9042011-07-22 13:56:51 -0400202.TP
Dylan Reid6cae0b22015-11-18 18:47:49 -0800203\fB-P <dir>\fR
204Set \fIdir\fR as the root fs using \fBpivot_root\fR. Implies \fB-v\fR, not
205compatible with \fB-C\fR.
206.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400207\fB-r\fR
Dylan Reid6cae0b22015-11-18 18:47:49 -0800208Remount /proc readonly. This implies \fB-v\fR. Remounting /proc readonly means
209that even if the process has write access to a system config knob in /proc
210(e.g., in /sys/kernel), it cannot change the value.
Elly Jonescd7a9042011-07-22 13:56:51 -0400211.TP
Luis Hector Chavez7058a2d2018-01-29 08:41:34 -0800212\fB-R <rlim_type>,<rlim_cur>,<rlim_max>\fR
Mike Frysingere34d7fe2018-05-23 04:18:30 -0400213Set an rlimit value, see \fBgetrlimit\fR(2) for more details.
214
215\fIrlim_type\fR may be specified using symbolic constants like \fIRLIMIT_AS\fR.
216
217\fIrlim_cur\fR and \fIrlim_max\fR are specified either with a number (decimal or
218hex starting with \fI0x\fR), or with the string \fIunlimited\fR (which will
219translate to \fIRLIM_INFINITY\fR).
Dylan Reid0f72ef42017-06-06 15:42:49 -0700220.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400221\fB-s\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400222Enable \fBseccomp\fR(2) in mode 1, which restricts the child process to a very
223small set of system calls.
Mike Frysingere61fd662017-06-20 14:07:41 -0400224You most likely do not want to use this with the seccomp filter mode (\fB-S\fR)
225as they are completely different (even though they have similar names).
Will Drewry32ac9f52011-08-18 21:36:27 -0500226.TP
227\fB-S <arch-specific seccomp_filter policy file>\fR
Mike Frysinger0fe4e4f2017-06-20 14:01:09 -0400228Enable \fBseccomp\fR(2) in mode 13 which restricts the child process to a set of
Luis Hector Chavezc3e17722018-10-16 20:43:12 -0700229system calls defined in the policy file. Note that system call names may be
230different based on the runtime environment; see \fBminijail0\fR(5) for more
231details.
Elly Jonescd7a9042011-07-22 13:56:51 -0400232.TP
Jorge Lucangeli Obes959f6562017-02-07 11:03:46 -0500233\fB-t[size]\fR
Mike Frysingerec7def22017-01-13 18:44:45 -0500234Mounts a tmpfs filesystem on /tmp. /tmp must exist already (e.g. in the chroot).
Martin Pelikánab9eb442017-01-25 11:53:58 +1100235The filesystem has a default size of "64M", overridden with an optional
236argument. It has standard /tmp permissions (1777), and is mounted
237nodev/noexec/nosuid. Implies \fB-v\fR.
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800238.TP
Matthew Dempsky2ed09122016-02-11 09:43:37 -0800239\fB-T <type>\fR
Graziano Misuraca58602a82017-08-28 17:33:15 -0700240Assume binary's ELF linkage type is \fItype\fR, which must be either 'static'
241or 'dynamic'. Either setting will prevent minijail0 from manually parsing the
242ELF header to determine the type. Type 'static' can be used to avoid preload
243hooking, and will force minijail0 to instead set everything up before the
244program is executed. Type 'dynamic' will force minijail0 to preload
245\fIlibminijailpreload.so\fR to setup hooks, but will fail on actually
246statically-linked binaries.
Matthew Dempsky2ed09122016-02-11 09:43:37 -0800247.TP
Stéphane Lesimple8d7174b2020-02-07 20:51:08 +0100248\fB-u <user|uid>\fR
249Change users to the specified \fIuser\fR name, or numeric user ID \fIuid\fR.
Elly Jonescd7a9042011-07-22 13:56:51 -0400250.TP
Brian Norris3b5841b2016-03-16 16:43:49 -0700251\fB-U\fR
252Enter a new user namespace (implies \fB-p\fR).
253.TP
Elly Jonescd7a9042011-07-22 13:56:51 -0400254\fB-v\fR
255Run inside a new VFS namespace. This option makes the program's mountpoints
256independent of the rest of the system's.
Dylan Reid6cae0b22015-11-18 18:47:49 -0800257.TP
258\fB-V <file>\fR
259Enter the VFS namespace specified by \fIfile\fR.
Jorge Lucangeli Obes13650612016-09-02 11:27:29 -0400260.TP
Chirantan Ekbote866bb3a2017-02-07 12:26:42 -0800261\fB-w\fR
262Create and join a new anonymous session keyring. See \fBkeyrings\fR(7) for more
263details.
264.TP
Lutz Justen13807cb2017-01-03 17:11:55 +0100265\fB-y\fR
266Keep the current user's supplementary groups.
267.TP
Jorge Lucangeli Obes13650612016-09-02 11:27:29 -0400268\fB-Y\fR
269Synchronize seccomp filters across thread group.
Mike Frysingerb9a7b162017-05-30 15:25:49 -0400270.TP
Luis Hector Chavez9dd13fd2018-04-19 20:14:47 -0700271\fB-z\fR
272Don't forward any signals to the jailed process. For example, when not using
273\fB-i\fR, sending \fBSIGINT\fR (e.g., CTRL-C on the terminal), will kill the
274minijail0 process, not the jailed process.
275.TP
276\fB--ambient\fR
277Raise ambient capabilities to match the mask specified by \fB-c\fR. Since
278ambient capabilities are preserved across \fBexecve\fR(2), this allows for
279process trees to have a restricted set of capabilities, even if they are
280capability-dumb binaries. See \fBcapabilities\fR(7).
281.TP
Mike Frysingerb9a7b162017-05-30 15:25:49 -0400282\fB--uts[=hostname]\fR
283Create a new UTS/hostname namespace, and optionally set the hostname in the new
284namespace to \fIhostname\fR.
Luis Hector Chavez114a9302017-09-05 20:36:58 -0700285.TP
286\fB--logging=<system>\fR
287Use \fIsystem\fR as the logging system. \fIsystem\fR must be one of
Mike Frysinger3e6a12c2019-09-24 12:50:55 -0400288\fBauto\fR (the default), \fBsyslog\fR, or \fBstderr\fR.
289
290\fBauto\fR will use \fBstderr\fR if connected to a tty (e.g. run directly by a
291user), otherwise it will use \fBsyslog\fR.
Luis Hector Chavezd45fc422017-10-25 15:11:53 -0700292.TP
293\fB--profile <profile>\fR
294Choose from one of the available sandboxing profiles, which are simple way to
295get a standardized environment. See the
296.BR "SANDBOXING PROFILES"
297section below for the full list of supported values for \fIprofile\fR.
Luis Hector Chavez9acba452018-10-11 10:13:25 -0700298.TP
299\fB--preload-library <file path>\fR
300Allows overriding the default path of \fI/lib/libminijailpreload.so\fR. This
301is only really useful for testing.
Luis Hector Chavezc3e17722018-10-16 20:43:12 -0700302\fB--seccomp-bpf-binary <arch-specific BPF binary>\fR
303This is similar to \fB-S\fR, but
304instead of using a policy file, \fB--secomp-bpf-binary\fR expects a
305arch-and-kernel-version-specific pre-compiled BPF binary (such as the ones
306produced by \fBparse_seccomp_policy\fR). Note that the filter might be
307different based on the runtime environment; see \fBminijail0\fR(5) for more
308details.
Luis Hector Chavezd45fc422017-10-25 15:11:53 -0700309.SH SANDBOXING PROFILES
310The following sandboxing profiles are supported:
311.TP
312\fBminimalistic-mountns\fR
313Set up a minimalistic mount namespace. Equivalent to \fB-v -P /var/empty
Jorge Lucangeli Obes7394b902019-03-14 12:43:26 -0400314-b / -b /proc -b /dev/log -t -r --mount-dev\fR.
Mike Frysingercc5917c2020-02-03 12:34:14 -0500315.TP
316\fBminimalistic-mountns-nodev\fR
317Set up a minimalistic mount namespace with an empty /dev path. Equivalent to
318\fB-v -P /var/empty -b/ -b/proc -t -r\fR.
Elly Jonescd7a9042011-07-22 13:56:51 -0400319.SH IMPLEMENTATION
320This program is broken up into two parts: \fBminijail0\fR (the frontend) and a helper
Luis Hector Chavez689deb72018-09-27 23:39:21 -0700321library called \fBlibminijailpreload\fR. Some jailings can only be achieved
322from the process to which they will actually apply:
323
324.IP
325\[bu] capability use (without using ambient capabilities): non-ambient
326capabilities are not inherited across \fBexecve\fR(2) unless the file being
327executed has POSIX file capabilities. Ambient capabilities (the
328\fB--ambient\fR flag) fix capability inheritance across \fBexecve\fR(2) to
329avoid the need for file capabilities.
330
331\[bu] seccomp: a meaningful seccomp filter policy should disallow
332\fBexecve\fR(2), to prevent a compromised process from executing a different
333binary. However, this would prevent the seccomp policy from being applied
334before \fBexecve\fR(2).
335.RE
Elly Jonescd7a9042011-07-22 13:56:51 -0400336
337To this end, \fBlibminijailpreload\fR is forcibly loaded into all
Luis Hector Chavez689deb72018-09-27 23:39:21 -0700338dynamically-linked target programs by default; we pass the specific
339restrictions in an environment variable which the preloaded library looks for.
340The forcibly-loaded library then applies the restrictions to the newly-loaded
341program.
342
343This behavior can be disabled by the use of the \fB-T static\fR flag. There
344are other cases in which the use of this flag might be useful:
345
346.IP
347\[bu] When \fIprogram\fR is linked against a different version of \fBlibc.so\fR
348than \fBlibminijailpreload.so\fR.
349
350\[bu] When \fBexecve\fR(2) has side-effects that interact badly with the
351jailing process. If the system uses SELinux, \fBexecve\fR(2) can cause an
352automatic domain transition, which would then require that the target domain
353allows the operations to jail \fIprogram\fR.
354.RE
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800355
Elly Jonescd7a9042011-07-22 13:56:51 -0400356.SH AUTHOR
Jorge Lucangeli Obesa521bee2016-03-03 13:47:57 -0800357The Chromium OS Authors <chromiumos-dev@chromium.org>
Elly Jonescd7a9042011-07-22 13:56:51 -0400358.SH COPYRIGHT
359Copyright \(co 2011 The Chromium OS Authors
360License BSD-like.
361.SH "SEE ALSO"
Mike Frysinger5a6bb502020-01-25 04:04:41 -0500362.BR libminijail.h ,
363.BR minijail0 (5),
364.BR seccomp (2)