Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: run Miri with
RUSTFLAGS="-Zrandomize-layout"
`cordyceps` and `maitake` currently contain code that perform layout-dependent casts (in this case, casting a ptr to struct to a ptr to the struct's first subfield), which would be UB if those structs were not `#[repr(C)]`. the `-Zrandomize-layout` flag tells the Rust compiler to randomize the layout of all `#[repr(Rust)]` structs (see rust-lang/compiler-team#457 for details). if we ever perform a layout-dependent cast on a struct that is not `#[repr(C)]` (or `#[repr(transparent)]`), layout randomization would break that cast. enabling this flag while running the Miri tests will help to catch any bugs introduced by accidentally performing such a cast on a non-layout-dependent type. i also made some changes to the `bin/miri` script. this was primarily to add comments on the individual flags that are added to `$MIRIFLAGS`, so that we can remember what they're doing when we look back at the script. the actual behavior should be identical, but the values added to `$MIRIFLAGS` are now declared in an array so that each flag can have a comment. Closes #229 Signed-off-by: Eliza Weisman <eliza@buoyant.io>
- Loading branch information