Skip to content

Add new libcxx flag for disabling container overflow checks for Asan. #437

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

Merged
merged 1 commit into from
Apr 25, 2025

Conversation

thetruestblue
Copy link
Contributor

@thetruestblue thetruestblue commented Apr 24, 2025

libcxx 20 has changed the naming scheme of internal macros that indicate feature availability. This affects the name of the macro used to include sanitizer container annotations -- it was renamed from _LIBCPP_HAS_NO_ASAN -> _LIBCPP_HAS_ASAN.

libcxx change: llvm/llvm-project#89178

This change adds the new flag name to maintain current behavior, which is to disable these checks by default.
Sanitizer container overflow checks are prone to false positives when vector objects are modified outside of instrumented code -- so we have historically defaulted to disabling this on Xcode projects via the libcxx macro.

rdar://149350723

libcxx changed the name of the macro used to include sanitizer container annotations.

We should add the new flag name to maintain current behavior.

Sanitizer container overflow checks are prone to false positives, so we default to disabling these on xcode projects.

rdar://149350723
@thetruestblue thetruestblue force-pushed the bg/add-new-libcpp-flag branch from 44023af to c704557 Compare April 24, 2025 22:48
@thetruestblue
Copy link
Contributor Author

@swift-ci please test

@owenv
Copy link
Collaborator

owenv commented Apr 25, 2025

@swift-ci test linux

Copy link

@var-const var-const left a comment

Choose a reason for hiding this comment

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

Thank you for finding and fixing this! Have you tested this change with both an old SDK (that doesn't support _LIBCPP_HAS_ASAN) and a new SDK (that doesn't support _LIBCPP_HAS_NO_ASAN) to make sure there are no macro-related warnings produced by the "extra" definition?

@thetruestblue
Copy link
Contributor Author

Thank you for finding and fixing this! Have you tested this change with both an old SDK (that doesn't support _LIBCPP_HAS_ASAN) and a new SDK (that doesn't support _LIBCPP_HAS_NO_ASAN) to make sure there are no macro-related warnings produced by the "extra" definition?

Yep I tested on both older and newer SDKs, there were no macro-related warnings in either case.

I wouldn't expect unused or extra macro definitions to trigger a warning, but I did check and confirmed.

@thetruestblue thetruestblue merged commit 39041d4 into main Apr 25, 2025
3 checks passed
@thetruestblue thetruestblue deleted the bg/add-new-libcpp-flag branch April 25, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants