Skip to content

Commit 9d03275

Browse files
authored
[ASan][libc++] Turn off SSO annotations for Apple platforms (#96269)
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
1 parent 2b37100 commit 9d03275

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libcxx/include/string

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,11 @@ private:
19831983
(void)__old_mid;
19841984
(void)__new_mid;
19851985
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
1986+
#if defined(__APPLE__)
1987+
// TODO: remove after addressing issue #96099 (https://github.com/llvm/llvm-project/issues/96099)
1988+
if(!__is_long())
1989+
return;
1990+
#endif
19861991
std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid);
19871992
#endif
19881993
}

0 commit comments

Comments
 (0)