commit | 9e1ac371045d0c2b4200441ccaa35188fa088988 | [log] [tgz] |
---|---|---|
author | Jorge Lucangeli Obes <[email protected]> | Thu Jan 23 14:36:50 2020 -0500 |
committer | Treehugger Robot <[email protected]> | Wed Sep 09 17:05:50 2020 +0000 |
tree | 030733f1e081dbcd16dd742f667d8b0a47334444 | |
parent | 4fc5781ed3ee9430291f5281812f4f6655eb70df [diff] |
minijail0: Remount mounts as MS_SLAVE by default. When executing the sandboxed program in a new mount namespace the Minijail library will by default remount all mounts with the MS_PRIVATE flag. While this is an appropriate, safe default for the library, MS_PRIVATE can be problematic: unmount events will not propagate into mountpoints marked as MS_PRIVATE. This can cause bugs (see code comments for details.) Fix by keeping MS_PRIVATE as default in libminijail.c but switch the default in minijail0_cli.c to MS_SLAVE. In order to avoid command-lines like "-Kprivate -v" overriding the -K option, call set_remount_mode() after all command-line options have been processed. Bug: 147609789 Test: Unit tests pass. Test: See repro steps in bug. Test: "minijail0 -Kprivate -v" remounts with MS_PRIVATE. Change-Id: I4788ffb92309d9b6e02a38ef2998bcecf5314b50
The Minijail homepage and main repo is https://android.googlesource.com/platform/external/minijail/.
There might be other copies floating around, but this is the official one!
Minijail is a sandboxing and containment tool used in Chrome OS and Android. It provides an executable that can be used to launch and sandbox other programs, and a library that can be used by code to sandbox itself.
You're one git clone
away from happiness.
$ git clone https://android.googlesource.com/platform/external/minijail $ cd minijail
Releases are tagged as linux-vXX
: https://android.googlesource.com/platform/external/minijail/+refs
See the HACKING.md document for more details.
See the RELEASE.md document for more details.
See the tools/README.md document for more details.
We've got a couple of contact points.
The following talk serves as a good introduction to Minijail and how it can be used.
The Chromium OS project has a comprehensive sandboxing document that is largely based on Minijail.
After you play with the simple examples below, you should check that out.
# id uid=0(root) gid=0(root) groups=0(root),128(pkcs11) # minijail0 -u jorgelo -g 5000 /usr/bin/id uid=72178(jorgelo) gid=5000(eng) groups=5000(eng)
# minijail0 -u jorgelo -c 3000 -- /bin/cat /proc/self/status Name: cat ... CapInh: 0000000000003000 CapPrm: 0000000000003000 CapEff: 0000000000003000 CapBnd: 0000000000003000