4 ms·
Forget the last paragraph. Literally opened answering your question: > My KVM Forum 2018 presentation titled Security in QEMU: How Virtual Machines provide Iso
by vlovich123 6y ago
Forget the last paragraph. Literally opened answering your question:
> My KVM Forum 2018 presentation titled Security in QEMU: How Virtual Machines provide Isolation (pdf) (video) reviewed security bugs in QEMU and found the most common causes were C programming bugs. This includes buffer overflows, use-after-free, uninitialized memory, and more. In this post I will argue for using Rust as a safer language that prevents these classes of bugs.
__found the most common causes were C programming bugs. This includes buffer overflows, use-after-free, uninitialized memory, and more__
- R0b0t1 6y agoSure, but the alternative is investing in static analysis for C code, of which there are plenty of tools for. My usage of rust for now has indicated to me that for most low level tasks you are better of using C or C++. It is more suited to it. There appears to be a lot of boilerplate in rust.
- swsieber 6y ago> but the alternative is investing in static analysis for C code, Yeah, the author explicitly acknowledges that: > Eliminating C programming bugs does not necessarily require switching programming languages. Other approaches to reducing bug rates in software include: > Coding style rules that forbid unsafe language features. > Building safe abstractions and prohibiting unsafe language features or library APIs. > Static checkers that scan source code for bugs. > Dynamic sanitizers that run software with instrumentation to identify bugs. > Unit testing and fuzzing. > The problem is, the QEMU community has been doing these things for years but new bugs are still introduced despite these efforts. It is certainly possible to spend more energy on these efforts but the evidence shows that bugs continue to slip through.
- R0b0t1 6y agoYes? Half of those are classes of bugs that would probably still exist with the usage of Rust, that is, they're simply a diversion from what you expected and what actually happens that the borrow checker can't save you from. You need to separate all bugs from the bugs Rust can't introduce. It's safer, in theory, to just do it in Rust first, but it is also important to consider the amount of time it actually takes to implement either. Why is this garnering downvotes...?
- Foober223 6y agoWelcome to the Rust world order domination brigade. /s
- alfalfasprout 6y agoIt's garnering downvotes because a lot of HN readers have never worked with a very large and mature codebase before and understand just how crazy a migration is. They seem to think that writing in Rust magically eliminates most bugs. No... it eliminates certain classes of bugs but instead you get plenty of logical bugs. The number of new bugs introduced in a migration would be enormous. It's not just "translating" the C into Rust-- you ideally need to write "idiomatic" Rust. Rust is a fantastic language but what I despise about its community is how they seem to think every C/C++ codebase should be rewritten in Rust. Either it's a monumental effort or it would decrease the developer base in many cases. In the case of C++ template libraries then it's in some cases even impossible to replicate functionality.
- zozbot234 6y ago> In the case of C++ template libraries then it's in some cases even impossible to replicate functionality. Rust has procedural macros that can replicate anything C++ templates can do, often more cleanly. And C/C++ are hardly immune from logical bugs.
- ncmncm 6y ago> "Rust has procedural macros that can replicate anything C++ templates can do" This is an entirely false statement. Wishful thinking makes a poor substitute for knowledge. Promoting wishful thinking against facts does all readers a disservice.
- tedmielczarek 6y agoHaving been significantly involved in the work to integrate Rust into Firefox I can say that while it's definitely nontrivial it's absolutely worthwhile. Every C++ developer I knew at Mozilla that took the time to learn Rust wound up being impressed with it and preferring to write Rust over C++.
- codetrotter 6y ago>> The problem is, the QEMU community has been doing these things for years but new bugs are still introduced despite these efforts. It is certainly possible to spend more energy on these efforts but the evidence shows that bugs continue to slip through. While personally being a proponent of Rust, I’ve been wondering if some of the projects that have codebases too big to realistically RIIR any time soon might benefit from running statical analysis as a git hook server side rejecting any commits that don’t pass some set of rules. Though, only having second-hand knowledge of statical analysis of C code through reading blog posts on the net, I am also of the impression that false positives are a common occurrence in statical analysis tools. So based on that I am thinking that it might either not be feasible, or at the very least it would be a major undertaking and you might need to continuously tune the rules and also bugs of this sort would perhaps still slip through.