by Thaxll · 6y ago · 0 comments
What a 1.5M LoC Rust low level kind of project looks like?
Hi, Article author here. I am not assuming Rust will fix all security issues. Bugs are still possible even in safe code, plus there will be unsafe code as you mentioned.
Unsafe code also worried me when evaluating Rust. Given the nature of Virtual Machine Monitors and emulators, isn't a lot of the program going to be unsafe? After studying existing Rust codebases and writing programs myself I found that it's still a significant improvement over C.
Whether Rust is safe enough depends on your requirements. For the QEMU, I think the answer is yes. For writing the firmware for a pacemaker implant or control software for a nuclear powerplant, I don't know :).
That very low level educational project can show how little unsafe is needed even at things running on bare metal.
I think you overestimate how much unsafe would be required. Most code, even low-level code can be safe.
Rust code does have unsafe at times, so it can still have memory safety issues.
It may not matter that your program is memory safe if it was written by people who don't understand the problem domain and doesn't work correctly. E.g. for qemu, it's perfectly possible to be absurdly vulnerable -- giving target code control of the host -- without any memory safety bug at all.
> without any memory safety bug at all.
Most QEMU escapes I have seen are memory safety issues in emulated devices.