Author: Reid Kleckner
Date: 2021-02-08T13:49:02-05:00
New Revision: bc39d53d9a4f1ed7c903648f3fd408296fd55c95

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

LOG: [🍒]Disable CFI in __get_elem to allow casting a pointer to uninitialized 
memory

Fixes usage of shared_ptr with CFI enabled, which is llvm.org/pr48993.

(cherry pick of commit bab74864168bb5e28ecbc0294fe1095d8da7f569)

Differential Revision: https://reviews.llvm.org/D96063

Added: 
    

Modified: 
    libcxx/include/memory

Removed: 
    


################################################################################
diff  --git a/libcxx/include/memory b/libcxx/include/memory
index a00916c8c03f..39d0f5bee6a5 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -2647,7 +2647,7 @@ private:
             _Alloc *__alloc = reinterpret_cast<_Alloc*>(__first);
             return __alloc;
         }
-        _Tp* __get_elem() _NOEXCEPT {
+        _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT {
             _CompressedPair *__as_pair = 
reinterpret_cast<_CompressedPair*>(__blob_);
             typename _CompressedPair::_Base2* __second = 
_CompressedPair::__get_second_base(__as_pair);
             _Tp *__elem = reinterpret_cast<_Tp*>(__second);


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to