• Home
Name Date Size #Lines LOC

..--

.github/workflows/04-Jul-2025-9666

examples/04-Jul-2025-9560

linux-x86/04-Jul-2025-6,6656,658

policies/04-Jul-2025-53

rust/04-Jul-2025-2,2421,870

test/04-Jul-2025-204142

tools/04-Jul-2025-5,6184,598

.clang-formatD04-Jul-2025246 109

.gitignoreD04-Jul-2025655 5037

Android.bpD04-Jul-202514.2 KiB558499

CPPLINT.cfgD04-Jul-202517 21

CleanSpec.mkD04-Jul-20252.2 KiB521

DIR_METADATAD04-Jul-20251.2 KiB4035

HACKING.mdD04-Jul-20252.9 KiB8762

LICENSED04-Jul-20251.5 KiB2928

METADATAD04-Jul-202539 43

MODULE_LICENSE_BSDD04-Jul-20250

MakefileD04-Jul-202510.7 KiB308171

NOTICED04-Jul-20251.5 KiB2827

OWNERSD04-Jul-2025324 1210

OWNERS_GENERALD04-Jul-202558 43

PRESUBMIT.cfgD04-Jul-2025840 1611

PREUPLOAD.cfgD04-Jul-2025219 96

README.mdD04-Jul-20255 KiB147103

RELEASE.mdD04-Jul-2025530 2517

TEST_MAPPINGD04-Jul-2025495 3130

arch.hD04-Jul-20252.7 KiB9879

bpf.cD04-Jul-202510.2 KiB400309

bpf.hD04-Jul-20257 KiB227156

common.mkD04-Jul-202533 KiB966567

config_parser.cD04-Jul-20253.9 KiB154104

config_parser.hD04-Jul-20251.2 KiB5626

config_parser_unittest.ccD04-Jul-20253.8 KiB137107

dump_constants.ccD04-Jul-20251.5 KiB5138

elfparse.cD04-Jul-20254.7 KiB11887

elfparse.hD04-Jul-20253.5 KiB10070

gen_constants-inl.hD04-Jul-20252.4 KiB8158

gen_constants.cD04-Jul-202531 21

gen_constants.shD04-Jul-20251.7 KiB6738

gen_syscalls-inl.hD04-Jul-20252.4 KiB11891

gen_syscalls.cD04-Jul-202524 21

gen_syscalls.shD04-Jul-20251.6 KiB6637

get_googletest.shD04-Jul-2025337 125

landlock.hD04-Jul-20253.3 KiB13759

landlock_util.cD04-Jul-20251.7 KiB6349

landlock_util.hD04-Jul-20253.1 KiB9657

libconstants.hD04-Jul-2025377 168

libminijail-private.hD04-Jul-20252.8 KiB10126

libminijail.cD04-Jul-2025108.2 KiB4,2263,019

libminijail.hD04-Jul-202526.7 KiB707233

libminijail.pc.inD04-Jul-2025157 97

libminijail_unittest.ccD04-Jul-202563 KiB2,1661,624

libminijailpreload.cD04-Jul-20254.9 KiB15477

libsyscalls.hD04-Jul-2025421 1810

minijail0.1D04-Jul-202518.9 KiB446445

minijail0.5D04-Jul-20257 KiB211209

minijail0.cD04-Jul-20252.1 KiB8452

minijail0.shD04-Jul-2025309 102

minijail0_cli.cD04-Jul-202543.5 KiB1,5031,200

minijail0_cli.hD04-Jul-2025666 3015

minijail0_cli_unittest.ccD04-Jul-202520.4 KiB694425

navbar.mdD04-Jul-2025346 129

parse_seccomp_policy.ccD04-Jul-20252.8 KiB11085

platform2_preinstall.shD04-Jul-2025300 167

scoped_minijail.hD04-Jul-2025582 3621

setup.pyD04-Jul-20251.3 KiB4332

signal_handler.cD04-Jul-20251.6 KiB8356

signal_handler.hD04-Jul-2025319 154

syscall_filter.cD04-Jul-202524 KiB934652

syscall_filter.hD04-Jul-20252.1 KiB9670

syscall_filter_unittest.ccD04-Jul-202560.8 KiB2,0731,470

syscall_filter_unittest_macros.hD04-Jul-20256.1 KiB126101

syscall_wrapper.cD04-Jul-2025836 3521

syscall_wrapper.hD04-Jul-2025963 4528

system.cD04-Jul-202515 KiB587371

system.hD04-Jul-20251.9 KiB8346

system_unittest.ccD04-Jul-20258.6 KiB270165

test_util.ccD04-Jul-20251.3 KiB6044

test_util.hD04-Jul-20252.2 KiB9852

testrunner.ccD04-Jul-2025675 3115

unittest_util.hD04-Jul-20252.4 KiB10577

util.cD04-Jul-202516.2 KiB712497

util.hD04-Jul-202512.8 KiB428155

util_unittest.ccD04-Jul-202514 KiB449350

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