4 ms·
Ah, cool. Performance is really difficult to properly measure, because each of these projects have different performance profiles, and new ones keep popping up
by steveklabnik 8y ago
Ah, cool.
Performance is really difficult to properly measure, because each of these projects have different performance profiles, and new ones keep popping up, like Lucet did today! And if you write a benchmark, then something like https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-%F0%9F%8E%89/ https://hacks.mozilla.org/2018/10/calls-between-javascript-a... happens, and all of a sudden the numbers are all different. So it's really hard to speak about wasm generally this way, it's better to talk about specific implementations and use-cases, IMHO. And to understand that benchmarks need to be updated in order to still be relevant.
Security is an interesting axis; like the JVM (as far as I know), wasm is memory safe by design. But security is more holistic than that. One interesting thing about wasm is that you have to say up-front what things you want to call in the host, which provides the ability for the host to say "nope, you're not gonna be able to do that." And of course, logic bugs can lead to security vulnerabilities in all of these platforms.
- k__ 8y agoI see. Nice, sounds like the Android/Fuchsia approach security-wise :)
- ridiculous_fish 8y agoI think wasm's memory safety is weaker than JVM. wasm's checking occurs at control flow points and the linear memory boundary, but does not extend down to individual objects. For example arrays are not bound checked in wasm.
- steveklabnik 8y agoWasm doesn't really have "arrays", so I don't think wasm checking them would really make sense. I guess you could argue that this is a distinction without a difference. You still won't get memory unsafety, which in my mind, is the higher order bit. YMMV of course.
- pjmlp 8y agoIt is possible to corrupt data on the stack due to out of bounds.
- steveklabnik 8y agoYes, bugs can always exist.
- rixed 8y agoNot sure what you mean by that, but probably not that stack corruption is a necessary evil of any language.
- pjmlp 8y agoNot when you use a VM that actually cares about security at all layers, but anyway WASM is doing everything better. /s
- Rusky 8y agoUsing such a VM requires rewriting existing C code. Wasm's approach allows that to happen incrementally, where it matters, by using memory safe languages like Rust, instead of relying on the VM.
- pjmlp 8y agoNot at all, as proven by memory tagging on Solaris/SPARC, iOS and upcoming Android/ARM v8.3. So leaving memory tagging out of WASM was a deliberate design decision. There are already better alternatives to write secure code if using C is not a requirement, so again nothing new on WASM other than its hype.
- Rusky 8y agoSure, and we use software memory tagging with things like LLVM sanitizers. It's great. But a) the hardware Wasm needs to support doesn't have tagging, and b) the software equivalent requires support from the allocator and has a large performance penalty. So yes, it was a deliberate design decision, taken in order to support existing C programs on the Web. This is really getting tiring- learning from the past is great, but fetishizing it to the point of denying anything new has any value is... not.
- Rusky 8y agoThe JVM and wasm have completely different memory safety stories on the inside of the sandbox, because wasm can run arbitrary C, so it has to cope with that somehow. But the thing Steve is pointing out is that they're equivalent from the outside, where neither can corrupt the host environment.
- ridiculous_fish 8y agoBut this is true of an ordinary Unix process too, via virtual memory. A Unix process can’t corrupt the kernel or other processes. But in practice there’s still a lot you can do with a buffer overflow vulnerability.
- littlestymaar 8y agoThe issue with Unix process is that a process has the same rights than the user who ran that process. The design goal of WASI is to provide a capability-based system[1], so an attacker exploiting a buffer overflow wouldn't be able to access things that the original program wasn't supposed to. [1]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webas...
- hawski 8y agoThen it's a bit bizarre to call it memory safe. I would say that "sandbox" is far more established term for what it is or does. Because if by using seccomp and/or user namespaces I would say that Linux/C is memory safe wouldn't it be an unhelpful statement? Can we say that Chrome or Qemu are implemented on memory safe platform?