Merged
Conversation
Since the new stack overflow detection system (ocaml#8670), ASAN was confused. We fix the issue by resetting the 'use_sigaltstack' flag and by disabling ASAN on functions used by the stack overflow handler.
Contributor
Author
|
Could someone add the "no change entry required" tag on this PR? |
xavierleroy
approved these changes
Oct 19, 2019
Contributor
xavierleroy
left a comment
There was a problem hiding this comment.
Thanks for your expertise with the sanitizers, much appreciated.
If I understand correctly:
use_sigaltstack=0instructs the sanitizer that we are using sigaltstack for our own purposes.- The
CAMLno_asanannotations are put on functions that run on the alternate stack. Without this annotation, ASAN sees code that accesses a global variable as if it were the call stack and complains about it.
Looks good to me! Merging.
Comment on lines
508
to
519
| #define CAMLno_tsan | ||
| #define CAMLno_asan | ||
| #if defined(__has_feature) | ||
| # if __has_feature(thread_sanitizer) | ||
| # undef CAMLno_tsan | ||
| # define CAMLno_tsan __attribute__((no_sanitize("thread"))) | ||
| # endif | ||
| # if __has_feature(address_sanitizer) | ||
| # undef CAMLno_asan | ||
| # define CAMLno_asan __attribute__((no_sanitize("address"))) | ||
| # endif | ||
| #endif |
Contributor
There was a problem hiding this comment.
For other readers who might wonder about it:
#if defined(__has_feature) && __has_feature(thread_sanitizer)
wouldn't work with GCC (and perhaps other non-Clang compilers) because it would try to expand __has_feature(thread_sanitizer) even though the left part of && is false.
This justifies the #define / #undef / #define dance.
xavierleroy
pushed a commit
that referenced
this pull request
Oct 19, 2019
Contributor
|
"Extra-check" CI is happy. Cherry-picked to 4.10 as commit 0ba3ab1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the new stack overflow detection system (#8670), ASAN was confused.
We fix the issue by resetting the 'use_sigaltstack' flag and by disabling
ASAN on functions used by the stack overflow handler.