rust-osdev / multiboot2

Rusty wrappers for Multiboot2.
Apache License 2.0
113 stars 56 forks source link

multiboot2: massive refactoring, removed UB, Miri passes all tests #226

Closed phip1611 closed 3 months ago

phip1611 commented 3 months ago

About

This PR contains a massive refactoring of various internals. Now, all unit tests pass Miri, thus we removed lots of undefined behaviour and increased the memory safety! 🎉 Only a small part of these internal refactorings leak to the public interface. If you don't provide external custom tags, you should be fine.

Impact of Release

Please note that all previous releases must be considered unsafe, as they contain UB. However, it is never clear how UB results in immediate incorrect behaviour and it might work. Nevertheless, users should migrate to the latest release and they will be fine!

All previous releases on crates.io will be yanked, once this is released.

Code Changes

It was not really possible to split this into smaller commits or smaller PRs. At least not without massive time investment. The main changes are that there are now the internal types GenericTag and TagBytesRef, the refactoring of TagTrait, and that BoxedDst was replaced by new_boxed() which returns a normal Box.

Miri is now 100% happy - This is great success and a big improvement. #160 is entirely closed.

Technical Insights

Memory Properties of this crate:

All these things are now solved. This is also done in a nice, non-hacky way.