4 ms·
> I'd love QEMU to move to some safer language. Unfortunately I don't know any which meet the necessary criteria: - support linux, osx, windows - mature enough
by AnthonyMouse 11y ago
> I'd love QEMU to move to some safer language. Unfortunately I don't know any which meet the necessary criteria: - support linux, osx, windows - mature enough for widespread support in distros - support at least half a dozen different host cpu architectures - simply interoperable at a C ABI level so you can move parts of the system to the new language without doing a 100% rewrite
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.
- JoshTriplett 11y agoThere's a big difference between "easy to use" and "hard to misuse". The problem with C++11 or C++14 is that, for all their additional features, you're still just one cast away from a bug like this.
- pcwalton 11y agounique_ptr isn't safe, and it doesn't provide any safety that you didn't have with smart pointers in earlier versions of C++. 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.
- telos 11y agoThis isn't true - unique_ptr provides protection against Use after Free which is one of the most common memory corruption vulnerabilities in modern applications.
- pcwalton 11y agoNo, it doesn't. There are many ways to get use after free using unique_ptr combined with references or this pointers.
- RotsiserMho 11y agoProtection != prevention
- pcwalton 11y agoI don't know what this means, but if you're implying that unique_ptr is good enough to prevent use after free in practice, that is obviously empirically false. Every browser engine, for example, uses C++11 and regularly has exploitable use after free.