Re:Mozilla Research Projects
by mindcrime on Tuesday December 23, 2014 @11:24PM
(#8791531)
Hmmm... would it make sense to talk about a JVM written in Rust? Could that make it easier to write a safe JVM that would be less susceptible to exploits? It would be wonderful if we could get there and have a Mozilla browser with "out of the box" Java support without needing a separate plugin.
[ Parent
| on HN ]
Aren't most or nearly all of the Java exploits related to running sandboxed code? Instead of relying on a code security model, use containers or other external permission systems.
For Microsoft, all the RCE were either use of C/++ or loading .Net into partially trusted scopes (like a browser).
I think Rust would have perhaps fixed a few of the managed runtime vulnerabilities, but probably not the majority. Forget sandboxing and you're done.
>Aren't most or nearly all of the Java exploits related to running sandboxed code?
Yes. Memory corruption flaws are still found with some regularity in the JVM, but they probably represent less than 10-20% of browser security issues.
Rust can't really make JIT compiled code substantially safer. JIT compilers are pretty much the unsafest things ever.
To be specific: Rust's memory safety guarantees only guarantee that the Rust code is free from memory safety violations, it can't make any sort of guarantees that the output of that code is sane. That said, maybe the other features like ADTs and explicit compile-time tracking of ownership make writing correct JITs (slightly) easier over plain C++, but that's yet to be seen (and it seems like it would be small in any case).
There are already JVMs written in Java like JikesRVM, Graal/SubstrateVM and a few others.
There is little that Rust safety could add over Java memory safety.
There have been talks that Hotspot might eventually give place to Graal, but no plans were ever given.