Skip to content

Commit

Permalink
[ASan][libc++] Turn off SSO annotations for Apple platforms (#96269)
Browse files Browse the repository at this point in the history
Summary:
This commit disables short string AddressSanitizer annotations on Apple
platforms as a temporary solution to the problem reported in #96099.

For more information on Apple's block implementation, please refer to
clang/docs/Block-ABI-Apple.rst [1]. The core issue lies in the fact
that blocks are unaware of their content, causing AddressSanitizer
errors when blocks are moved using `memmove`.

I believe - and I'm not alone - that the issue should ideally be
addressed within the block moving logic. However, this patch provides
a temporary fix until a proper resolution exists in the Blocks runtime.

[1]: https://github.com/llvm/llvm-project/blob/main/clang/docs/Block-ABI-Apple.rst

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251313
  • Loading branch information
AdvenamTacet authored and yuxuanchen1997 committed Jul 25, 2024
1 parent 88689ad commit 78f779b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libcxx/include/string
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,11 @@ private:
(void)__old_mid;
(void)__new_mid;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if defined(__APPLE__)
// TODO: remove after addressing issue #96099 (https://github.com/llvm/llvm-project/issues/96099)
if(!__is_long())
return;
#endif
std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid);
#endif
}
Expand Down

0 comments on commit 78f779b

Please sign in to comment.