test: run Miri with RUSTFLAGS="-Zrandomize-layout"
#231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cordyceps
andmaitake
currently contain code that performlayout-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 thelayout of all
#[repr(Rust)]
structs (see rust-lang/compiler-team#457for details). if we ever perform a layout-dependent cast on a struct
that is not
#[repr(C)]
(or#[repr(transparent)]
), layoutrandomization 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 toadd comments on the individual flags that are added to
$MIRIFLAGS
, sothat 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 acomment.
Closes #229
Signed-off-by: Eliza Weisman [email protected]