Skip to content

sanitizers: Implement support for the sanitize ignorelist - #157808

Open
1c3t3a wants to merge 9 commits into
rust-lang:mainfrom
1c3t3a:sanitizer-ignorelist
Open

sanitizers: Implement support for the sanitize ignorelist#157808
1c3t3a wants to merge 9 commits into
rust-lang:mainfrom
1c3t3a:sanitizer-ignorelist

Conversation

@1c3t3a

@1c3t3a1c3t3a commented Jun 12, 2026

Copy link
Copy Markdown
Member

View all comments

The sanitize ignorelist gives central controls over which functions, files, etc. should be ignored and not sanitized. It is a common file format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change adds support for this list in Rust as well.

r? @rcvalle

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in tests/codegen-llvm/sanitizer

cc @rcvalle

@rustbotrustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 12, 2026
@rust-log-analyzer

This comment has been minimized.

@1c3t3a
1c3t3aforce-pushed the sanitizer-ignorelist branch 2 times, most recently from 624834b to 693e22fCompareJune 12, 2026 12:49
@1c3t3a
1c3t3a requested a review from rcvalleJune 12, 2026 14:20
Comment threadcompiler/rustc_codegen_llvm/src/builder.rs Outdated
Comment threadcompiler/rustc_codegen_llvm/src/builder.rs Outdated
Comment threadcompiler/rustc_codegen_llvm/src/builder.rs Outdated
@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 12, 2026
@1c3t3a
1c3t3a requested a review from rcvalleJune 15, 2026 08:54
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 15, 2026
@rust-bors

This comment has been minimized.

Comment threadcompiler/rustc_codegen_llvm/src/common.rs Outdated
Comment threadtests/codegen-llvm/sanitizer/ignorelist/cfi-ignorelist.rs
RustString::build_byte_buffer(f)
}

pub(crate) struct SanitizerIgnoreList {

@rcvallercvalleJul 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved to the rustc_sanitizers crate? Maybe an ignorelist module there? Are there any other things that could be moved there?

View changes since the review

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it makes sense to live there. I just want to know that this relies on LLVM specific ffi calls and types. I replicated/moved the necessary pieces, but please take a look if it makes sense like this, alternatively rustc_sanitizer could be generic over these types and routines (a bit like rustc_codegen_ssa is), but it may be a bit ugly and similar amounts of code as if we don't move it :) I am fine with either!

Comment threadcompiler/rustc_codegen_llvm/src/attributes.rs
@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 28, 2026
@1c3t3a
1c3t3aforce-pushed the sanitizer-ignorelist branch from a24ff27 to eeed708CompareAugust 27, 2026 10:12
@rustbot

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

This comment has been minimized.

The sanitize ignorelist gives central controls over which functions,
files, etc. should be ignored and not sanitized. It is a common file
format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change
adds support for this list in Rust as well.
@1c3t3a
1c3t3aforce-pushed the sanitizer-ignorelist branch from eeed708 to 066c9e1CompareAugust 27, 2026 10:17
@1c3t3a
1c3t3a requested a review from rcvalleAugust 27, 2026 10:18
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 27, 2026
src:*src-ignore-memory.rs

[cfi]
fun:*test_cfi*

@jakos-secjakos-secAug 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a concept of different CFI violation types in Rust?

I've just fixed that those get correctly reported by UBSAN here: llvm/llvm-project#213224, since then we can easily generate ignorelists if the type printed in there is the same as the section in the ignorelist.

So we should make sure that the output from UBSAN for CFI violations correspond to the section name for the ignore here.

View changes since the review

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! My understanding is that this commit should handle that correctly?

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@1c3t3a
1c3t3aforce-pushed the sanitizer-ignorelist branch from 3f6de90 to 1cb8361CompareAugust 27, 2026 16:30
@rust-log-analyzer

This comment has been minimized.

@1c3t3a
1c3t3aforce-pushed the sanitizer-ignorelist branch from 1cb8361 to a9e36d5CompareAugust 28, 2026 08:59
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.PG-exploit-mitigationsProject group: Exploit mitigationsS-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@1c3t3a@rustbot@rust-log-analyzer@rcvalle@jakos-sec