Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some sanitizers should be target modifiers #138453

Open
Darksonn opened this issue Mar 13, 2025 · 6 comments
Open

Some sanitizers should be target modifiers #138453

Darksonn opened this issue Mar 13, 2025 · 6 comments
Labels
A-sanitizers Area: Sanitizers for correctness and code quality C-bug Category: This is a bug. F-target_modifiers `#![feature(target_modifiers)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Darksonn
Copy link
Contributor

Darksonn commented Mar 13, 2025

Some sanitizers need to be target modifiers, and some do not. For now, we should mark all sanitizers as target modifiers except for these: AddressSanitizer, LeakSanitizer

For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier. Same applies to #138311 when it lands.

The shadow-call-stack sanitizer is currently being considered as a target modifier for simplicity. However, there are cases where it does not need to be a target modifier.

Please see the target modifiers tracking issue for more details. See also the Tracking Issue for stabilizing the sanitizers.

cc @rcvalle @azhogin @maurer
@rustbot label F-target_modifiers A-sanitizers

@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-sanitizers Area: Sanitizers for correctness and code quality F-target_modifiers `#![feature(target_modifiers)]` labels Mar 13, 2025
@tmiasko
Copy link
Contributor

tmiasko commented Mar 13, 2025

MemorySanitizer and ThreadSanitizer should be considered target modifiers as well.

@tmiasko tmiasko removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2025
@Darksonn
Copy link
Contributor Author

Ok, thanks. Updated.

@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 13, 2025
@azhogin
Copy link
Contributor

azhogin commented Mar 16, 2025

Also, from zulip thread:

they should be target modifiers iff they lead to unsoundness when different values of the flag are used for different parts of what eventually becomes a single binary

18:20
I think -Csoft-float should just be removed, though if someone cares about the feature it could be kept as a target modifier (but the implementation would need to be changed for that, currently rustc assumes it can just look at the target spec to determine whether the current arm target uses hardfloat or softfloat ABI)

18:21
for -Ctarget-feature=-neon, we'll have to decide what to do with target features currently marked as "forbidden": do we still allow overwriting them with a target modifier, and if so how?

18:22
I'm open to the idea of allowing that, though it would need some careful design around what to do for nonsense combination where there just isn't a well-defined ABI. maybe that should be a separate -C flag though.

18:25
-neon on an aarch64 hardfloat target is a "nonsense ABI" case so it's unclear what we should even do when allowing the flag, I think it should just be a hard error

18:25
the more interesting question is atomics-32 on arm and forced-atomics on riscv; those probably should become target modifiers

18:27
long-term we should probably treat all target features that we do not know as target modifiers

@azhogin
Copy link
Contributor

azhogin commented Mar 22, 2025

Draft PR: #138736. Has problems with tests using sanitizers inconsistent with std deps.

@tmiasko
Copy link
Contributor

tmiasko commented Mar 22, 2025

Using -C unsafe-allow-abi-mismatch in existing tests should be fine. Ideally tests would rebuild the standard library, but it is not clear to me whether it is worth it given the complexity and compile time cost.

@azhogin
Copy link
Contributor

azhogin commented Mar 24, 2025

-C unsafe-allow-abi-mismatch

Yes, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sanitizers Area: Sanitizers for correctness and code quality C-bug Category: This is a bug. F-target_modifiers `#![feature(target_modifiers)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants