5 ms·
"Take existing C code, compile it to WebAssembly, transpile it back to C, and you get the same code, but sandboxed." Nice!
by sp332 3y ago
"Take existing C code, compile it to WebAssembly, transpile it back to C, and you get the same code, but sandboxed." Nice!
- PaulHoule 3y agoIt helps so much that the WebAssembly "virtual machine" promises so little (compared to, say, Java.)
- Lerc 3y agoThat really epitomizes the proverb, Either make something so simple that it obviously has no flaws or make something so complex that no flaws are obvious.
- IshKebab 3y agoThis is already in Firefox: https://rlbox.dev/ https://rlbox.dev/
- chrismorgan 3y agoI strongly recommend reading through this site if this topic interests you at all (which it probably does if you’re reading this comments thread!). Lot of explanation and detail about how it works, what it does, and how to use it yourself. It’s good stuff. And yeah, it’s been in Firefox for two years now: https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/ https://hacks.mozilla.org/2021/12/webassembly-and-back-again....
- turbolent 3y agoJust to clarify: Compared to wasm2c, w2c2 does not (yet) have sandboxing capabilities, so assumes the translated WebAssembly module is trustworthy. The main "goal" of w2c2 so far has been allowing to port applications and libraries to as many systems as possible.
- westurner 3y agohttps://gvisor.dev/docs/architecture_guide/platforms/ https://gvisor.dev/docs/architecture_guide/platforms/ : > gVisor requires a platform to implement interception of syscalls, basic context switching, and memory mapping functionality. Internally, gVisor uses an abstraction sensibly called Platform. Chrome sandbox: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/design/sandbox.md https://chromium.googlesource.com/chromium/src/+/refs/heads/... Firefox sandbox: https://wiki.mozilla.org/Security/Sandbox https://wiki.mozilla.org/Security/Sandbox Chromium sandbox types summary: https://github.com/chromium/chromium/blob/main/docs/linux/sandboxing.md#sandbox-types-summary https://github.com/chromium/chromium/blob/main/docs/linux/sa... Minijail: https://github.com/google/minijail https://github.com/google/minijail : > Minijail is a sandboxing and containment tool used in ChromeOS 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. Chrome vulnerability reward amounts: https://bughunters.google.com/about/rules/5745167867576320/chrome-vulnerability-reward-program-rules#reward-amounts https://bughunters.google.com/about/rules/5745167867576320/c... Systemd has SystemCallFilter= to limit processes to certain syscall: https://news.ycombinator.com/item?id=36693366 https://news.ycombinator.com/item?id=36693366 Nerdctl: https://github.com/containerd/nerdctl https://github.com/containerd/nerdctl Nerdctl, podman, and podman-remote do rootless containers.
- 10000truths 3y agoThis feels like a really roundabout way to implement something that the compiler should be responsible for. All the pain and effort of C -> WASM -> C could be avoided if GCC or clang had some option to add bounds checking instrumentation for each memory access in the compiled output.
- ithkuil 3y agoNaCl solved that long time ago
- phickey 3y agoit solved it so well that nobody outside of chrome ever implemented nacl, and chrome's nacl team became their webassembly team
- ithkuil 3y agoThat's perfectly compatible with the claim that from a technical pov pnacl solved the issue. There were other good reasons why that wasn't ultimately the road taken, but they largely were know technical reasons.
- lambda 3y agoYeah, WASM was the result of taking a look at NaCl, realizing it could never be specified and independently implemented, and writing a spec for something better that could. WASM is superior in pretty much all ways to NaCl other than being a bit more time to go through the whole specification and implementation process. NaCl was a great prototype, and WASM is a much more polished result because of it.
- jancsika 3y agoOoh, I'd love to know a few more details about both. What kept NaCl from being independently implemented? And what did WASM learn from NaCl? Edit: ah, someone already mentioned NaCl being CPU-specific.
- deleted 3y ago[deleted]
- mattsan 3y agoOh dude imagine using cosmocc on the final C code and have a single binary that runs on 6 different OS's