QEMU: out-of-bounds memory access issue
access.redhat.com
access.redhat.com
seccomp is pretty awesome IMO. Would that more software opted in to dropping unneeded system access.
Of course, it doesn't completely prevent someone from doing something nasty, but it does force them to be much more targeted in which programs they can attack. Every little thing helps a little bit, and it all adds up.
Seccomp is quite cool because it lets you filter syscalls and then there's no way for you to disable the filtering (assuming no bugs in the implementation).
https://github.com/qemu/qemu/blob/master/qemu-seccomp.c
There's also no further refinement of seccomp privileges at runtime, so that list of syscalls is statically whitelisted up front and nothing else is done (search 'seccomp' in the repository). Is there anything I obviously couldn't achieve with that list of syscalls?
Given the list of what's whitelisted for the whole process, I wouldn't put much stock in it, for now. qemu would probably need some real upgrades and significant work to make this more fine grained and reduce the attack surface using it (both against the kernel and for rogue programs attacking the host qemu instance itself).
Least you did your part getting us a start on it. It could be ported to a simpler, safer language and runtime.
Whereas, languages like Modula-3, Ada, or safe variants of C are straight-forward to map to real hardware with small to no runtimes and libraries in same language. Many checks in by default. Two, C subsets and SPARK, can be proven free of common errors.
There's a vast difference in safety between such languages and the Java platform. Complexity of compiler/runtime and unsafe libraries are main reasons. Safety-critical, minimal runtimes exist for Java but they're slow and I doubt you paid $$$ for them. ;)
http://lafo.ssw.uni-linz.ac.at/papers/2015_CGO_Graal.pdf
...I could've replied immediately. Graal keeps HotSpot VM, presumably libraries too, while replacing the JIT with an extra-aggressive one (semantic risk) coded in Java (lower code-risk). It's still bad as it barely addresses platform's overall risk. Might make a better, safer JIT for existing platform.
The [potentially] better ones are those designed for high-reliability applications such as Aonix's PERC and JamaicaVM. They tend to try to do less with more predictability. There was one implemented on Oberon called Jaos JVM. Also, although JVM itself is orthogonal to this, you can run your Java program on JX Operating System for higher security.
I double checked and it appears that almost all of the Java core libraries (rt.jar) are indeed already written in Java. (More a point of information than anything else)
1) Class loader
2) Bytecode interpreter
3) 2 JITs
4) 3 Garbage collectors
5) High performance synchronization primitives
My understanding is that the aim of Graal is to replace the JITs, that Truffle will replace (1) and (2) and the Substrate VM will replace (4) and (5).
So most of the C/C++ should disappear. (I don't know what the substrate VM is written in, but it is much smaller regardless)
http://www.oracle.com/technetwork/java/jvmls2013wimmer-20140...
The documentation of all of them is terrible as there's no clear explanation of Truffle and Substrate: jumps right into technical stuff with a barrage of techniques. Truffle appears to be a toolkit for generating parsers/compilers plus integration interface for the VM's. I don't see mention of replacing class loader and bytecode interpreter. Whereas Graal is a combo, per slide images, of Hotspot bottom parts and Java-based compiler/JIT. It at least has huge code reduction plus safer code over original VM in their illustrations. Only 60Kloc.
Going from there, the linked PDF shows Truffle connecting to either GraalVM or Substrate VM. In one slide, it references GraalVM like it's necessary for integrating with Java applications while calling Substrate embeddable. Makes me think Substrate is standalone apps. In another slide, it visually implies that Substrate compiles your code and just Java classes you need into one executable that maybe can't load others. It's not clear if Substrate is reusing the C/C++ code of 1, 2, 4, or 5 from HotSpot for lower layers.
All in all, they're doing interesting things but I'm too confused to evaluate them. Do you have any links that are more specific on these issues, esp how SubstrateVM works or whether Graal uses C/C++ code for bottom layers as in picture? I can't evaluate them without even an internal architecture description.
Hello! A good chunk of the users of this site build stuff for a living and for fun!
Just to be clear, I didn't set that up. In fact I was rather amazed at that question arriving in my lap.
(There are probably other requirements too but that last one is the biggie really.)
Low level coders were using straight Assembly.
I find ironic to see such statements about 40 years later.
What other safe C subsets/variants are out there which are actively being worked on?
Cyclone and bit-c interested me greatly so pointers would be appreciated.
> Cyclone was an early attempt to create a programming language at the level of C, combining manual memory management with complete static memory safety. You can think of it as one step on the path that Rust and other languages have continued, one that I believe will eventually replace C, eliminating a host of severe security problems.
Still have to force or pay them to do it as the C zeal is so strong. Yet, the smaller the adjustment, the more likely the uptake. Worked for C and Java vs others that clean-slated things.
https://www.cs.rutgers.edu/~santosh.nagarakatte/softbound/
http://sva.cs.illinois.edu/downloads.html
http://dslab.epfl.ch/proj/cpi/
Paper mentioning several of the safe C's, including those like Vault you can't have:
https://pdfs.semanticscholar.org/a890/a850dc78e65e26f8f4def4...
Galois, as usual, graciously open-sourced two of theirs (Ivory & Tower) that's already fielded in real world:
Popcorn and TALC are older ones in prototype form:
https://www.cs.cornell.edu/talc/releases.html
Someone here showed me this one I haven't evaluated but is used in compiler front-end:
https://eigenstate.org/myrddin/
The C0 one used in Verisoft is embedded in vc0compiler-trunk probably. They did great things with it but I haven't been brave enough to try to retrieve it ;).
http://www.verisoft.de/VerisoftRepository.html
So, altogether, what remains is quite scattered and prototype form. Plus, you still have to rewrite the software. So, I've mostly been recommending people apply Softbound, SAFECode, and CPI to their code just to see what happens. If it still works and fast enough, then just use it as it covers most bases. Also, contributing to those three's codebase is a very, wise move with potentially large impact.
In the meantime, here's an article I wrote on the /dev/kvm API, including how to drive it directly from a small C program: https://lwn.net/Articles/658511/ (edit: fixed URL)
Why can't we just alias the storage to something different underneath? How is there a "hard" requirement? Unless it's difficult/impossible to make the representation align correctly without the same semantics?
(Though I should caution that it's not as simple as "just write in a safe language" if you're doing the tricks that QEMU does for speed. That's not to say we shouldn't be moving away from C and C++ in general, however--we should.)
Rust is not ready for linux yet.
(no, `curl -sSf https://static.rust-lang.org/rustup.sh | sh` does not count)
Firefox now has Rust code in it, so any distro that compiles from source and has Firefox is gonna end up packaging rustc too.
There is something to be said for replacing C and old C++ code with C++11 and the safer new constructs like std::unique_ptr. It doesn't stop you from doing unsafe things but it makes it much easier not to, without requiring a complete rewrite.
In fact, I'm even skeptical of the claim that unique_ptr provides significant security benefits over malloc and free. Leaks aren't the kinds of security problems we're talking about here.