Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minijail: support compiling policies to BPF #83477

Merged
merged 4 commits into from Apr 1, 2020
Merged

Conversation

alyssais
Copy link
Member

Motivation for this change

I plan to use this in crosvm. This is required for build crosvm HEAD, but fails on the crosvm in the current Chromium OS release. So I’ll wait until a new crosvm is released to integrate it there. But it’s good to have support in minijail anyway.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Switched from the android-* tags to the linux-* ones, because Upstream
says "Releases are tagged as `linux-vXX`".
This is built from the same source as minijail, but is for all intents
and purposes a seperate package.  It builds different things, with no
overlap, and is under a different license.
This is a syscall table used for compiling Minijail policy files to
BPF.  The compiler is available in the minijail-tools package.  The
file is generated by compiling and running a small program named
dump_constants.

When cross-compiling, we have to get the syscall table for the host
platform.  To do this, dump_constants is run under QEMU user emulation
for the appropriate platform.  Google takes the same approach in their
minijail packages for ChromiumOS[1].

[1]: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/729bd4269a47870380f8dde0b162de355ce89dfe/chromeos-base/minijail/minijail-9999.ebuild#49
@alyssais alyssais merged commit 139a15e into NixOS:master Apr 1, 2020
@alyssais alyssais deleted the minijail branch April 1, 2020 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants