Add support for -Zsanitizer-cfi-minimal-runtime - #162493
Conversation
Co-Authored-By: Bastian Kersting <bkersting@google.com>
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? rcvalle |
|
Would you mind adding tests it similarly to https://github.com/rust-lang/rust/blob/main/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs and https://github.com/rust-lang/rust/blob/main/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs (i.e., requires CFI, not just CFI diagnostics or CFI recovery)? |
I'm not entirely sure what the best behavior is here. Now that we have tests that cfi-diag and cfi-recover require cfi, this should already be enough. Otherwise we would need to add a separate error message for all the different cases (you need a specific error message for |
b2af13f to
5ee5ebd
Compare
This comment has been minimized.
This comment has been minimized.
Failing tests I need to look at / fix before another round of reviews. |
|
Would you mind adding tests it similarly to https://github.com/rust-lang/rust/blob/main/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs and https://github.com/rust-lang/rust/blob/main/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs (i.e., requires CFI, not just CFI diagnostics or CFI recovery)?
Yes, I think this is how the Rust compiler does it and historically this is how we've been doing it. This also aligns with the philosophy of having clear and helpful error messages. In this case, with only one incorrect run, the user would be able to see both requirements without requiring one additional run. |
For production use, we should only link in the ubsan_minimal runtime, instead of the complete ubsan runtime. This adds support for both cfi-recover and cfi-diag to use the minimal runtime when `-Zsanitizer-cfi-minimal-runtime` is specified. This also includes tests, to ensure the flag can only be used if either cfi-recover or cfi-diag is enabled, it doesn't disrupt the original behavior, and links in the correct runtime when specified. Co-Authored-By: Bastian Kersting <bkersting@google.com>
Co-Authored-By: Bastian Kersting <bkersting@google.com>
5ee5ebd to
b47e873
Compare
Makes sense, should be added now.
These should also be addressed now. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #162631) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
For production use, we should only link in the ubsan_minimal runtime,
instead of the complete ubsan runtime. This adds support for both
cfi-recover and cfi-diag to use the minimal runtime when
-Zsanitizer-cfi-minimal-runtimeis specified.This also includes tests, to ensure the flag can only be used if either
cfi-recover or cfi-diag is enabled, it doesn't disrupt the original
behavior, and links in the correct runtime when specified.
cc @1c3t3a
?r rcvalle