[libcxx-commits] [PATCH] D95827: Avoid cast<T*> before T is constructed to pacify CFI checks

Reid Kleckner via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 2 12:39:36 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbab74864168b: Disable CFI in __get_elem to allow casting a pointer to uninitialized memory (authored by rnk).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95827/new/

https://reviews.llvm.org/D95827

Files:
  libcxx/include/memory


Index: libcxx/include/memory
===================================================================
--- libcxx/include/memory
+++ libcxx/include/memory
@@ -2647,7 +2647,7 @@
             _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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95827.320885.patch
Type: text/x-patch
Size: 624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210202/a613a667/attachment.bin>


More information about the libcxx-commits mailing list