News for hackers. Stuff that matters.
Re:WebAssembly: The New Kubernetes? by manmal on Friday January 21, 2022 @07:50AM (#30022726)
Modern hypervisors have astonishing performance, and I don’t see why Chrome and Safari wouldn’t manage to eventually provide a similarly efficient implementation.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @08:46AM (#30023363)
Modern hypervisors don't run bytecode and are using the CPU to do security enforcement, not software emulating it like WASM is forced to do (since it's not using a hardware protection domain, aka a process)
Re:WebAssembly: The New Kubernetes? by paavohtl on Friday January 21, 2022 @03:00PM (#30029156)
WASM was explicitly designed to be easy to into native code. No production-ready WASM runtime is interpreting bytecode in hot code paths.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @04:17PM (#30030124)
Easy to convert to native code is very different from easy to convert to optimal native code. Just like WASM having performance as a design goal both doesn't mean they achieved it nor does it mean that it won when a compromise had to be made against other design goals like portability or security.

In fact I'm quite certain that whenever portability or security ran up against performance in WASM's design, that performance always lost. Those other two goals were definitely a higher priority for WASM's designers.

Stable, portable byte codes are always inherently lossy. Information that could be (and often is) useful to optimizers is lost in that conversion. Then the conversion from byte code to running code also is on the hot path - it's on the hot path of starting execution. This is the same problem existing byte code solutions face, like CLR & JVM. WASM didn't manage to magic a solution where nobody else had. It's the same thing that's been done to death, just with "web" slapped on the front of it & bundled in a browser. That part of "being in a browser" makes it interesting for web devs, sure, but in the broader context of "all of computing" it's... just not? It's what we already have had (and been using!) for decades.

Re:WebAssembly: The New Kubernetes? by Findecanor on Friday January 21, 2022 @06:22PM (#30031269)
For some server applications using WASM the biggest performance benefit is not really how fast it is running but how fast it is to start a new WASM instance compared to launching a new OS process.

However, I think it would be possible to make systems in which similar instances, because they are written in a type-safe, memory-safe language in the first place, could bypass WASM and both start up fast and run fast optimised code.

I have done some research on portable bytecodes, and have some novel ideas for getting more performance, but I agree that the inherent problem remains. One thing that help make optimised C/C++ fast is that optimisers assume that undefined behaviour doesn't get triggered. But in a system for portable code, you can't just assume - you'd have to prove that it can not exist to be able to do the same optimisations, and that is far from straightforward. And when it triggers, it has to work the same say, or it won't be portable (bug-compatible) between hardware.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @10:13AM (#30024545)
WASM is more secure than a hypervisor, since it prevents code injection.
Re:WebAssembly: The New Kubernetes? by eyberg on Friday January 21, 2022 @12:40PM (#30026991)
It is trivial to modify function pointers, implemented as indirect calls and "read-only" data in wasm.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @03:50PM (#30029820)
Yes, WASM in combination with an unsafe language is less secure than memory safe languages, but more secure than a hypervisor. You can also use WASM with a memory safe language.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @04:19PM (#30030146)
WASM is less secure than a regular process boundary, and far less secure than a hypervisor. I'm not sure where you're getting this from? Things like spectre mitigations in CPUs are not doing anything for the likes of WASM, after all, they only target process & ring boundaries. It's why you have to enable COOP and COEP to use thread with WASM - because the security for WASM's threads comes from the CPU enforcing process boundaries, not from WASM's sandbox.
Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @05:14PM (#30030662)
If we are concerned with leakage of user data available in your own web program, then unsafe WASM code is more secure than unsafe code in a hypervisor because it prevents RCE, which results in full control of the hypervisor environment, which also enables transient attacks against the host environment, if there are vulnerabilities in your hypervisor (previously hypervisors had to be patched for Spectre). If we are talking about host platform protection against arbitrary malicious code, information leakage from neighboring processes/tabs, WASM is no different from a process boundary, at least in chrome, because that's how it's implemented. It's an implementation detail independent of WASM. Could as well be implemented with hardware virtualization, but it would make interfacing with browser APIs more expensive, probably to the point of impracticality.
Re:WebAssembly: The New Kubernetes? by kllrnohj on Friday January 21, 2022 @06:58PM (#30031580)
Are you trying to say that code compiled with CFI is less vulnerable than code that wasn't? In which case sure, but that's entirely orthogonal to WASM. Code inside WASM isn't otherwise inherently protected. Code reuse attacks via indirect calls are still possible, as are of course side channel attacks and data leaks.

And since WASM uses linear memory and lacks things like ASLR, the code in the sandbox cannot achieve the same level of protection it could if it was in a hypervisor.

Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @05:59AM (#30035600)
No need for RCE when data corruption suffices to change code paths.
Re:WebAssembly: The New Kubernetes? by eyberg on Friday January 21, 2022 @04:11PM (#30030055)
It doesn't matter if it's rust or not. You can still modify read only data and still redirect indirect calls. You can still modify the stack and the heap. Rust changes nothing.

Also, not sure where the comparison to a hypervisor is coming into play. As @kllrnohj mentioned hypervisors are relying on actual hardware.

Re:WebAssembly: The New Kubernetes? by nullifidian on Friday January 21, 2022 @04:24PM (#30030191)
I'm not a rust expert, but I thought rust without unsafes should prevent such things at the compile time. C# and Java will be compiled into WASM differently, I believe no less securely than JVM or .NET. Having information leaks is still better than arbitrary code execution.
Re:WebAssembly: The New Kubernetes? by pjmlp on Saturday January 22, 2022 @06:01AM (#30035615)
No safe language in the world prevents anything if the attacker can change the binary contents, it is no longer the code produced by the compiler.

That is why we have signed binary execution to start with, WASM doesn't support any of this.