[libcxx-commits] [libcxx] 9d03275 - [ASan][libc++] Turn off SSO annotations for Apple platforms (#96269)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 14:24:14 PDT 2024


Author: Tacet
Date: 2024-07-19T17:24:10-04:00
New Revision: 9d03275550d33636a066f84ee3aab81ad1339637

URL: https://github.com/llvm/llvm-project/commit/9d03275550d33636a066f84ee3aab81ad1339637
DIFF: https://github.com/llvm/llvm-project/commit/9d03275550d33636a066f84ee3aab81ad1339637.diff

LOG: [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

Added: 
    

Modified: 
    libcxx/include/string

Removed: 
    


################################################################################
diff  --git a/libcxx/include/string b/libcxx/include/string
index 54e9d8990c220..2fd1b1e745908 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -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
   }


        


More information about the libcxx-commits mailing list