-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make ASAN actually do something and fix all the things #46336
Conversation
8a04e68
to
1acecb7
Compare
Analogous to (and dependent on) #46336, but for msan. The biggest change is a workaround for LLVM's lack for TLS relocation support (I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815, but that was x86_64-linux-gnu only, while this workaround works everywhere - though we should consider resurrecting my patch for performance at some point). The rest is mostly build fixes and plumbing to get the sanitizer flags through to the dependencies.
We've had the ability to build with ASAN for quite a while, but at some point the LLVM pass stopped doing anything unless you also annotated the function with the `sanitize_address` attribute, so if you built Julia with asan enabled, very few things were actually built with asan and those that were didn't have one of asan's most crucial features enabled: Tracking out of bounds stack accesses. This PR enabled asan-stack handling, adds the appropriate asan poison handling to our tasks and fixes a plethora of other things that didn't work with asan enabled. The result of this PR (together with a few other PRs still pending) should be that asan passes tests on master. This was a significant amount of work, and the changes required quite subtle. As a result, I think we should make sure to quickly set up CI to test this configuration and make sure it doesn't regress.
Analogous to (and dependent on) #46336, but for msan. The biggest change is a workaround for LLVM's lack for TLS relocation support (I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815, but that was x86_64-linux-gnu only, while this workaround works everywhere - though we should consider resurrecting my patch for performance at some point). The rest is mostly build fixes and plumbing to get the sanitizer flags through to the dependencies.
Analogous to (and dependent on) #46336, but for msan. The biggest change is a workaround for LLVM's lack for TLS relocation support (I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815, but that was x86_64-linux-gnu only, while this workaround works everywhere - though we should consider resurrecting my patch for performance at some point). The rest is mostly build fixes and plumbing to get the sanitizer flags through to the dependencies.
Analogous to (and dependent on) #46336, but for msan. The biggest change is a workaround for LLVM's lack for TLS relocation support (I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815, but that was x86_64-linux-gnu only, while this workaround works everywhere - though we should consider resurrecting my patch for performance at some point). The rest is mostly build fixes and plumbing to get the sanitizer flags through to the dependencies.
@@ -76,17 +76,16 @@ void jl_init_stack_limits(int ismaster, void **stack_lo, void **stack_hi) | |||
#if defined(_COMPILER_GCC_) && __GNUC__ >= 12 | |||
#pragma GCC diagnostic ignored "-Wdangling-pointer" | |||
#endif | |||
*stack_hi = (void*)&stacksize; |
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.
why are we using &stacksize
rather than the value of it as stackaddr + stacksize
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.
I don't know, but the former is slightly smaller of course. I guess it may prevent us from smashing any extra information the system may have put at the stack base.
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.
we should never smash this; we just use it to decide if it hit a StackOverflow
We've had the ability to build with ASAN for quite a while, but
at some point the LLVM pass stopped doing anything unless you
also annotated the function with the
sanitize_address
attribute,so if you built Julia with asan enabled, very few things were
actually built with asan and those that were didn't have one
of asan's most crucial features enabled: Tracking out of bounds
stack accesses.
This PR enabled asan-stack handling, adds the appropriate asan
poison handling to our tasks and fixes a plethora of other things
that didn't work with asan enabled. The result of this PR (together
with a few other PRs still pending) should be that asan passes
tests on master.
This was a significant amount of work, and the changes required
quite subtle. As a result, I think we should make sure to quickly
set up CI to test this configuration and make sure it doesn't
regress.