Skip to content

Fix 'extra-check' INRIA CI#9053

Merged
xavierleroy merged 1 commit intoocaml:trunkfrom
jhjourdan:fix_extract_checks
Oct 19, 2019
Merged

Fix 'extra-check' INRIA CI#9053
xavierleroy merged 1 commit intoocaml:trunkfrom
jhjourdan:fix_extract_checks

Conversation

@jhjourdan
Copy link
Copy Markdown
Contributor

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.

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.
@jhjourdan
Copy link
Copy Markdown
Contributor Author

Could someone add the "no change entry required" tag on this PR?

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

Thanks for your expertise with the sanitizers, much appreciated.

If I understand correctly:

  • use_sigaltstack=0 instructs the sanitizer that we are using sigaltstack for our own purposes.
  • The CAMLno_asan annotations 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
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.

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 xavierleroy merged commit 5a53560 into ocaml:trunk Oct 19, 2019
xavierleroy pushed a commit that referenced this pull request Oct 19, 2019
Since the new stack overflow detection system (#8670), ASAN was confused.
We fix the issue by telling ASAN to not use a sigaltstack, and by disabling
ASAN on functions used by the stack overflow handler.

(cherry picked from commit 5a53560)
@xavierleroy
Copy link
Copy Markdown
Contributor

"Extra-check" CI is happy. Cherry-picked to 4.10 as commit 0ba3ab1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants