by lhnz · 4y ago · 0 comments
So, no matter how evil, or confused, the program is, you aren't risking your entire system. It's the best part of capability based security.
Capabilities are no Silver Bullet. They work exceptionally well with small teams, but like memory leaks, reachability decisions tend not to scale to very large teams, and people start exposing information for a feature without being able to trace the consequences of having done so.
I could potentially see someone recasting this story as a parable against shared state, but I'm not convinced it's the sole cause or that you could have one without the other. I think it is true that they share a problem space, but that's neither a particularly brave nor illuminating statement.
It works on web too.
This is not just a theory: according to https://hacks.mozilla.org/2021/12/webassembly-and-back-again... Firefox does exactly that trick with five of its C or C++ dependencies.
I love capability based limits like this (and in Deno), but they’re not a panacea.
> Back to the future
> For those of you who have been around for the better part of the past couple of decades, you may notice this looks very similar to RFC3875, better known as CGI (The Common Gateway Interface). While our example here certainly does not conform to the specification, you can imagine how this can be extended to turn the stdin of a basic 'command line' application into a full-blown http handler.
they should've started with that ;)
[1] https://paulbutler.org/2021/calling-webassembly-from-rust/
(nb. if I were to write this post today, it would be an omission not to mention the component model)
They are far from the only implementation, though. You can find links to other runtimes in other comments here already.
My takeaway so far is: it’s a faster, more flexible, and lighter JVM-like thing.
As someone who had written Java Applets from back in the day on the UI side, and written plenty of server side and seen a lot of FaaS successes and failures (more the latter than the former), all the features and use cases map 1:1 - so not really new use cases. Just way better design and implementation (which may make architectures actually end-user usable), w/o money-ed interest.
TL;DR, spicy take: “.class file v2”
Is there any benchmarks showing that wasmtime code can run faster than the equivalent JVM code?
How is Wasmtime more flexible than the JVM?
It's definitely lighter, for now, but I am not sure that will always be the case with the many WASM proposals.
Having rust, go, c, c++, being able to be transpiled to wasm byte code is already more flexible than jvm. Why isn’t there a popular C front end to jvm? -> there’s the flex. Also wasm runs in browser w/o loading applets.
Worry about bloat when the project is more mature; there’s no bloat right now and worth exploring.
Actually, wasm is less flexible than the JVM because with GraalVM/Truffle you can run:
1. WASM
2. LLVM bitcode
both on the JVM, alongside all the other languages it can do like Python, Ruby, Clojure, JavaScript, Kotlin, Smalltalk, R etc. Therefore you can run Rust, C and C++ on the JVM. Don't think you can run Go, but this is still way more languages on the JVM than WASM.
https://www.graalvm.org/22.2/reference-manual/llvm/
https://www.graalvm.org/22.2/reference-manual/wasm/
When running these bytecodes on GraalVM, you also get full interop between languages:
https://www.graalvm.org/22.2/reference-manual/polyglot-progr...
You ask why there's no popular C frontend for the JVM. It's because nobody really cares about running C on a VM except for people targeting Chrome/Safari. You can do it with GraalVM and it has some uses for running C language extensions to scripting languages, but otherwise is a bit of a curiousity. Usually if you want to call a C library it's because it's an operating system API or because you want to do things that a VM wouldn't do well anyway e.g. stuff with inline native assembly.
Sounds like “far fewer features” to me. Anything that has a lot of features, accumulates a lot if design and implementation compromises (“flaws”)