Skip to content

Commit 78f779b

Browse files
AdvenamTacetyuxuanchen1997
authored andcommitted
[ASan][libc++] Turn off SSO annotations for Apple platforms (#96269)
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
1 parent 88689ad commit 78f779b

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)