|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| .github/workflows/ | | 04-Jul-2025 | - | 96 | 66 |
| examples/ | | 04-Jul-2025 | - | 95 | 60 |
| linux-x86/ | | 04-Jul-2025 | - | 6,665 | 6,658 |
| policies/ | | 04-Jul-2025 | - | 5 | 3 |
| rust/ | | 04-Jul-2025 | - | 2,242 | 1,870 |
| test/ | | 04-Jul-2025 | - | 204 | 142 |
| tools/ | | 04-Jul-2025 | - | 5,618 | 4,598 |
| .clang-format | D | 04-Jul-2025 | 246 | 10 | 9 |
| .gitignore | D | 04-Jul-2025 | 655 | 50 | 37 |
| Android.bp | D | 04-Jul-2025 | 14.2 KiB | 558 | 499 |
| CPPLINT.cfg | D | 04-Jul-2025 | 17 | 2 | 1 |
| CleanSpec.mk | D | 04-Jul-2025 | 2.2 KiB | 52 | 1 |
| DIR_METADATA | D | 04-Jul-2025 | 1.2 KiB | 40 | 35 |
| HACKING.md | D | 04-Jul-2025 | 2.9 KiB | 87 | 62 |
| LICENSE | D | 04-Jul-2025 | 1.5 KiB | 29 | 28 |
| METADATA | D | 04-Jul-2025 | 39 | 4 | 3 |
| MODULE_LICENSE_BSD | D | 04-Jul-2025 | 0 | | |
| Makefile | D | 04-Jul-2025 | 10.7 KiB | 308 | 171 |
| NOTICE | D | 04-Jul-2025 | 1.5 KiB | 28 | 27 |
| OWNERS | D | 04-Jul-2025 | 324 | 12 | 10 |
| OWNERS_GENERAL | D | 04-Jul-2025 | 58 | 4 | 3 |
| PRESUBMIT.cfg | D | 04-Jul-2025 | 840 | 16 | 11 |
| PREUPLOAD.cfg | D | 04-Jul-2025 | 219 | 9 | 6 |
| README.md | D | 04-Jul-2025 | 5 KiB | 147 | 103 |
| RELEASE.md | D | 04-Jul-2025 | 530 | 25 | 17 |
| TEST_MAPPING | D | 04-Jul-2025 | 495 | 31 | 30 |
| arch.h | D | 04-Jul-2025 | 2.7 KiB | 98 | 79 |
| bpf.c | D | 04-Jul-2025 | 10.2 KiB | 400 | 309 |
| bpf.h | D | 04-Jul-2025 | 7 KiB | 227 | 156 |
| common.mk | D | 04-Jul-2025 | 33 KiB | 966 | 567 |
| config_parser.c | D | 04-Jul-2025 | 3.9 KiB | 154 | 104 |
| config_parser.h | D | 04-Jul-2025 | 1.2 KiB | 56 | 26 |
| config_parser_unittest.cc | D | 04-Jul-2025 | 3.8 KiB | 137 | 107 |
| dump_constants.cc | D | 04-Jul-2025 | 1.5 KiB | 51 | 38 |
| elfparse.c | D | 04-Jul-2025 | 4.7 KiB | 118 | 87 |
| elfparse.h | D | 04-Jul-2025 | 3.5 KiB | 100 | 70 |
| gen_constants-inl.h | D | 04-Jul-2025 | 2.4 KiB | 81 | 58 |
| gen_constants.c | D | 04-Jul-2025 | 31 | 2 | 1 |
| gen_constants.sh | D | 04-Jul-2025 | 1.7 KiB | 67 | 38 |
| gen_syscalls-inl.h | D | 04-Jul-2025 | 2.4 KiB | 118 | 91 |
| gen_syscalls.c | D | 04-Jul-2025 | 24 | 2 | 1 |
| gen_syscalls.sh | D | 04-Jul-2025 | 1.6 KiB | 66 | 37 |
| get_googletest.sh | D | 04-Jul-2025 | 337 | 12 | 5 |
| landlock.h | D | 04-Jul-2025 | 3.3 KiB | 137 | 59 |
| landlock_util.c | D | 04-Jul-2025 | 1.7 KiB | 63 | 49 |
| landlock_util.h | D | 04-Jul-2025 | 3.1 KiB | 96 | 57 |
| libconstants.h | D | 04-Jul-2025 | 377 | 16 | 8 |
| libminijail-private.h | D | 04-Jul-2025 | 2.8 KiB | 101 | 26 |
| libminijail.c | D | 04-Jul-2025 | 108.2 KiB | 4,226 | 3,019 |
| libminijail.h | D | 04-Jul-2025 | 26.7 KiB | 707 | 233 |
| libminijail.pc.in | D | 04-Jul-2025 | 157 | 9 | 7 |
| libminijail_unittest.cc | D | 04-Jul-2025 | 63 KiB | 2,166 | 1,624 |
| libminijailpreload.c | D | 04-Jul-2025 | 4.9 KiB | 154 | 77 |
| libsyscalls.h | D | 04-Jul-2025 | 421 | 18 | 10 |
| minijail0.1 | D | 04-Jul-2025 | 18.9 KiB | 446 | 445 |
| minijail0.5 | D | 04-Jul-2025 | 7 KiB | 211 | 209 |
| minijail0.c | D | 04-Jul-2025 | 2.1 KiB | 84 | 52 |
| minijail0.sh | D | 04-Jul-2025 | 309 | 10 | 2 |
| minijail0_cli.c | D | 04-Jul-2025 | 43.5 KiB | 1,503 | 1,200 |
| minijail0_cli.h | D | 04-Jul-2025 | 666 | 30 | 15 |
| minijail0_cli_unittest.cc | D | 04-Jul-2025 | 20.4 KiB | 694 | 425 |
| navbar.md | D | 04-Jul-2025 | 346 | 12 | 9 |
| parse_seccomp_policy.cc | D | 04-Jul-2025 | 2.8 KiB | 110 | 85 |
| platform2_preinstall.sh | D | 04-Jul-2025 | 300 | 16 | 7 |
| scoped_minijail.h | D | 04-Jul-2025 | 582 | 36 | 21 |
| setup.py | D | 04-Jul-2025 | 1.3 KiB | 43 | 32 |
| signal_handler.c | D | 04-Jul-2025 | 1.6 KiB | 83 | 56 |
| signal_handler.h | D | 04-Jul-2025 | 319 | 15 | 4 |
| syscall_filter.c | D | 04-Jul-2025 | 24 KiB | 934 | 652 |
| syscall_filter.h | D | 04-Jul-2025 | 2.1 KiB | 96 | 70 |
| syscall_filter_unittest.cc | D | 04-Jul-2025 | 60.8 KiB | 2,073 | 1,470 |
| syscall_filter_unittest_macros.h | D | 04-Jul-2025 | 6.1 KiB | 126 | 101 |
| syscall_wrapper.c | D | 04-Jul-2025 | 836 | 35 | 21 |
| syscall_wrapper.h | D | 04-Jul-2025 | 963 | 45 | 28 |
| system.c | D | 04-Jul-2025 | 15 KiB | 587 | 371 |
| system.h | D | 04-Jul-2025 | 1.9 KiB | 83 | 46 |
| system_unittest.cc | D | 04-Jul-2025 | 8.6 KiB | 270 | 165 |
| test_util.cc | D | 04-Jul-2025 | 1.3 KiB | 60 | 44 |
| test_util.h | D | 04-Jul-2025 | 2.2 KiB | 98 | 52 |
| testrunner.cc | D | 04-Jul-2025 | 675 | 31 | 15 |
| unittest_util.h | D | 04-Jul-2025 | 2.4 KiB | 105 | 77 |
| util.c | D | 04-Jul-2025 | 16.2 KiB | 712 | 497 |
| util.h | D | 04-Jul-2025 | 12.8 KiB | 428 | 155 |
| util_unittest.cc | D | 04-Jul-2025 | 14 KiB | 449 | 350 |
README.md
1# Minijail
2
3The Minijail homepage is
4https://google.github.io/minijail/.
5
6The main source repo is
7https://chromium.googlesource.com/chromiumos/platform/minijail.
8
9There might be other copies floating around, but this is the official one!
10
11[TOC]
12
13## What is it?
14
15Minijail is a sandboxing and containment tool used in ChromeOS and Android.
16It provides an executable that can be used to launch and sandbox other programs,
17and a library that can be used by code to sandbox itself.
18
19## Getting the code
20
21You're one `git clone` away from happiness.
22
23```
24$ git clone https://chromium.googlesource.com/chromiumos/platform/minijail
25$ cd minijail
26```
27
28Releases are tagged as `linux-vXX`:
29https://chromium.googlesource.com/chromiumos/platform/minijail/+refs
30
31## Building
32
33See the [HACKING.md](./HACKING.md) document for more details.
34
35## Release process
36
37See the [RELEASE.md](./RELEASE.md) document for more details.
38
39## Additional tools
40
41See the [tools/README.md](./tools/README.md) document for more details.
42
43## Contact
44
45We've got a couple of contact points.
46
47* [minijail@chromium.org]: Public user & developer mailing list.
48* [minijail-users@google.com]: Internal Google user mailing list.
49* [minijail-dev@google.com]: Internal Google developer mailing list.
50* [crbug.com/list]: Existing bug reports & feature requests.
51* [crbug.com/new]: File new bug reports & feature requests.
52* [Chromium Gerrit]: Code reviews.
53
54[minijail@chromium.org]: https://groups.google.com/a/chromium.org/forum/#!forum/minijail
55[minijail-users@google.com]: https://groups.google.com/a/google.com/forum/#!forum/minijail-users
56[minijail-dev@google.com]: https://groups.google.com/a/google.com/forum/#!forum/minijail-dev
57[crbug.com/list]: https://crbug.com/?q=component:OS>Systems>Minijail
58[crbug.com/new]: https://bugs.chromium.org/p/chromium/issues/entry?components=OS>Systems>Minijail
59[Chromium Gerrit]: https://chromium-review.googlesource.com/q/project:chromiumos/platform/minijail
60
61## GitHub Pages homepage
62
63The https://google.github.io/minijail/ homepage is maintained in the `gh-pages`
64branch, not in the `main` branch.
65Changes to it can be sent via Gerrit, but requires a little extra work.
66
67```shell
68# Make sure you have all the branches, and not only the "main" one.
69$ git fetch
70
71# Create a new local branch tracking the remote "gh-pages".
72# Git should automatically detect the remote and track it for you.
73$ git checkout gh-pages
74# If git can't auto-detect the remote, try one of these.
75$ git checkout -b gh-pages origin/gh-pages
76$ git checkout -b gh-pages cros/gh-pages
77
78# Make your changes like normal, then push them to Gerrit for review.
79# Here's a couple of different ways to post changes; you only need one!
80$ repo upload -D gh-pages
81$ git push origin HEAD:refs/for/gh-pages
82$ git push cros HEAD:refs/for/gh-pages
83
84# Now review your changes via Gerrit like normal.
85```
86
87Once a change merges into the `gh-pages` branch, there is no additional work for
88you other than waiting -- GitHub periodically syncs with our host, and then it
89will automatically regenerate the homepage when the `gh-pages` branch updates.
90
91## Talks and presentations
92
93The following talk serves as a good introduction to Minijail and how it can be used.
94
95[Video](https://drive.google.com/file/d/0BwPS_JpKyELWZTFBcTVsa1hhYjA/preview),
96[slides](https://docs.google.com/presentation/d/e/2PACX-1vRBqpin5xR9sng6lIBPjG0XQtu-uWWgr0ds-M3zW13XpDO-bTcMERLwoHUEB9078p1yqr9L-su9n5dk/pub).
97
98## Example usage
99
100The ChromiumOS project has a comprehensive
101[sandboxing](https://www.chromium.org/chromium-os/developer-library/guides/development/sandboxing)
102document that is largely based on Minijail.
103
104After you play with the simple examples below, you should check that out.
105
106### Change root to any user
107
108```
109# id
110uid=0(root) gid=0(root) groups=0(root),128(pkcs11)
111# minijail0 -u jorgelo -g 5000 /usr/bin/id
112uid=72178(jorgelo) gid=5000(eng) groups=5000(eng)
113```
114
115### Drop root while keeping some capabilities
116
117```
118# minijail0 -u jorgelo -c 3000 -- /bin/cat /proc/self/status
119Name: cat
120...
121CapInh: 0000000000003000
122CapPrm: 0000000000003000
123CapEff: 0000000000003000
124CapBnd: 0000000000003000
125```
126
127## Historical notes
128
129Q. "Why is it called minijail0?"
130
131A. It is minijail0 because it was a rewrite of an earlier program named
132minijail, which was considerably less mini, and in particular had a dependency
133on libchrome (the ChromeOS packaged version of Chromium's //base). We needed a
134new name to not collide with the deprecated one.
135
136We didn't want to call it minijail2 or something that would make people
137start using it before we were ready, and it was also concretely _less_ since it
138dropped libbase, etc. Technically, we needed to be able to fork/preload with
139minimal extra syscall noise which was too hard with libbase at the time (onexit
140handlers, etc that called syscalls we didn't want to allow). Also, Elly made a
141strong case that C would be the right choice for this for linking and ease of
142controlled surprise system call use.
143
144https://crrev.com/c/4585/ added the original implementation.
145
146Source: Conversations with original authors, ellyjones@ and wad@.
147