-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Add kernel-address sanitizer support for freestanding targets
#99679
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
Conversation
|
r? @cuviper (rust-highfive has picked a reviewer for you, use r? to override) |
|
This comment has been minimized.
This comment has been minimized.
52a015d to
f564b48
Compare
This comment has been minimized.
This comment has been minimized.
|
Amazing! 🎉 |
f564b48 to
4d3b130
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests we can add for this? Perhaps add to the sanitizer tests in src/test/codegen/?
How about some documentation in src/doc/unstable-book/src/compiler-flags/sanitizer.md?
Should this be added to Session::emit_lifetime_markers?
That sounds reasonable -- is there any reason not to add it there? |
it uses the same instrumentation as Address Sanitizer so I think it should be pretty simple to integrate with those, I'll take a look!
didn't even think of that! 😅 good catch
hmm, I'm not familiar with that area, but I'll see what I can find out!
I thought so too, but I can't say I'm 100% confident if it should be. @alex you added the original as for other targets, I was hoping to get some feedback from someone more familiar with the set of targets that would actually support this -- I'm mainly unsure of the various bare-metal ARM targets, but I'll also see if I can dig up what |
|
☔ The latest upstream changes (presumably #100537) made this pull request unmergeable. Please resolve the merge conflicts. |
|
based on the previous comment from @repnop, I assume this is waiting on @repnop to integrate the review feedback provided by @cuviper @rustbot label: -S-waiting-on-review S-waiting-on-author |
c91f6c2 to
b705dfb
Compare
|
@cuviper I believe all of the changes you requested are now done. I split out the tests where appropriate since the targets with the other sanitizers won't support this. I ran both of them locally with As for the |
This comment has been minimized.
This comment has been minimized.
b705dfb to
b3db2d5
Compare
|
@rustbot label -S-waiting-on-author +S-waiting-on-review |
|
☔ The latest upstream changes (presumably #102265) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Hey @cuviper, it looks like this PR is ready for another round of review. Thanks! 🙂 |
|
@repnop would you mind rebasing and resolving the merge conflicts? That will help shorten the review cycle. |
b3db2d5 to
98bbbc8
Compare
|
These commits modify compiler targets. |
This comment has been minimized.
This comment has been minimized.
fa5f1e5 to
b59522e
Compare
This comment has been minimized.
This comment has been minimized.
b59522e to
aac8575
Compare
|
☔ The latest upstream changes (presumably #107451) made this pull request unmergeable. Please resolve the merge conflicts. |
aac8575 to
373aaa1
Compare
|
@rustbot label -S-waiting-on-author +S-waiting-on-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple typos for riscv min-llvm-version.
373aaa1 to
3508161
Compare
|
☔ The latest upstream changes (presumably #108056) made this pull request unmergeable. Please resolve the merge conflicts. |
3508161 to
1971438
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors r+
(bah, bors doesn't see reviews...)
|
@bors r+ |
…cuviper
Add `kernel-address` sanitizer support for freestanding targets
This PR adds support for KASan (kernel address sanitizer) instrumentation in freestanding targets. I included the minimal set of `x86_64-unknown-none`, `riscv64{imac, gc}-unknown-none-elf`, and `aarch64-unknown-none` but there's likely other targets it can be added to. (`linux_kernel_base.rs`?) KASan uses the address sanitizer attributes but has the `CompileKernel` parameter set to `true` in the pass creation.
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (fabfd1f): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
This PR adds support for KASan (kernel address sanitizer) instrumentation in freestanding targets. I included the minimal set of
x86_64-unknown-none,riscv64{imac, gc}-unknown-none-elf, andaarch64-unknown-nonebut there's likely other targets it can be added to. (linux_kernel_base.rs?) KASan uses the address sanitizer attributes but has theCompileKernelparameter set totruein the pass creation.