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

Investigate Nix on CloudABI / WASI #2759

Open
Ericson2314 opened this issue Apr 10, 2019 · 15 comments
Open

Investigate Nix on CloudABI / WASI #2759

Ericson2314 opened this issue Apr 10, 2019 · 15 comments

Comments

@Ericson2314
Copy link
Member

Ericson2314 commented Apr 10, 2019

https://cloudabi.org/ is an interesting idea for bolting cap-safety onto legacy kernels. It would be very interesting to see a port of Nix to this syscall interface. In particular, I'd hope this would allow for very low-overhead sandboxed derivations, as much of the cost in the past has been manipulating the ambient namespaces which this avoids entirely.

CC @shlevy

Edit: Added WASI, which basically CloudABI + Web Assembly

@Ericson2314 Ericson2314 changed the title cloud abi Investigate Nix with CloudABI Apr 10, 2019
@Ericson2314 Ericson2314 changed the title Investigate Nix with CloudABI Investigate Nix on "CloudABI" Apr 10, 2019
@7c6f434c
Copy link
Member

Looking at the CloudABI introduction, it seems to have a different notion of running a program compared to, say POSIX (structured environment instead of command-line arguments, and capability token passing). I am not sure when, and if, a C compiler that would itself work under such rules will appear.

@Ericson2314
Copy link
Member Author

@7c6f434c Actually it's very much designed to be conservative enough that existing software can be shoehorned to work. See https://github.com/NuxiNL/cloudabi-ports; the first step is getting cross compilation to Cloud ABI in Nixpkgs working, cribbing from those bsd-style ports as necessary (should make another issue in Nixpkgs for that). Nix would be a more interesting port, but that's kind of the point :).

https://lwn.net/Articles/674770/ goes into more detail of how things work in the Linux version. Also compare the earlier Capsicum from Academia. (Still not sure to what degree the implementation is shared, but the article sort of hints at it.)

@7c6f434c
Copy link
Member

7c6f434c commented Apr 10, 2019 via email

@Ericson2314
Copy link
Member Author

@7c6f434c Yeah it would probably be easiest to cross compile Nix, and that Nix wouldn't be able to build most packages in Nixpkgs. But it would be really cool for experimental incremental software using the Nix daemon as an incremental cache. (e.g. compiler that forks off fine grained tasks as derivations. It would take a more radically redesigned Nix to make that "fork" maximally performant, but a basic demo of the concept can be made with today's Nix.)

@Ericson2314
Copy link
Member Author

CC @cleverca22, I feel like all this is vaguely up your alley.

@Ericson2314
Copy link
Member Author

Opened NixOS/nixpkgs#59285 for the Nix side of things.

@matthewbauer
Copy link
Member

I think we would get more hype/interest if we worked towards using WebAssembly/WASI. It’s got more people behind it, but also incorporates lots of the ideas behind CloudABI:

https://github.com/CraneStation/wasi-sysroot

I need to figure out how to bootstrap libc++ with LLVM before we can do that many interesting things with WebAssembly though.

@Ericson2314
Copy link
Member Author

Thanks for this! https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-overview.md mentions CloudABI a lot, so it makes sense to see this on a spectrum (WASM supports safer models than OS-sandboxed Cish).

@Ericson2314 Ericson2314 changed the title Investigate Nix on "CloudABI" Investigate Nix on CloudABI / WASI Apr 11, 2019
@shlevy
Copy link
Member

shlevy commented Apr 14, 2019

I'm not sure I see the point of this one. At the end of the day most of the work needs to happen with access to global namespaces, because at the end of the day everything still sucks and we're stuck with the build systems as they actually are.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Apr 14, 2019

@shlevy Everything indeed still sucks but:

  1. I'm mainly interested in doing this for sake of greenfield stuff on top, which can be right from the get go. Let this be the amphibian egg for some layer above chicken for a reinvented Nix chicken egg :).

  2. There's no security problem with creating a legacy unix sandbox from a cap-safe context. Were that an extension to WASI/CloudABI, we could shift all global namespace management from Nix to the derivations themselves, analogous to buildFHSUserEnv for building jank software.

@stale
Copy link

stale bot commented Feb 16, 2021

I marked this as stale due to inactivity. → More info

@stale
Copy link

stale bot commented Apr 29, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this as completed Apr 29, 2022
@Ericson2314
Copy link
Member Author

Still interested.

@Ericson2314 Ericson2314 reopened this Apr 29, 2022
@stale stale bot removed the stale label Apr 29, 2022
@stale stale bot added the stale label Oct 30, 2022
@armeenm
Copy link

armeenm commented Feb 26, 2023

Bump.

@stale stale bot removed the stale label Feb 26, 2023
@Ericson2314
Copy link
Member Author

Don't worry it won't be closed by stale bot again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants