[libcxx-commits] [PATCH] D96063: [🍒]Disable CFI in __get_elem to allow casting a pointer to uninitialized memory

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 4 10:38:04 PST 2021


ldionne created this revision.
ldionne added a reviewer: tstellar.
Herald added a subscriber: jkorous.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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

(cherry pick of commit bab74864168bb5e28ecbc0294fe1095d8da7f569 <https://reviews.llvm.org/rGbab74864168bb5e28ecbc0294fe1095d8da7f569>)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96063

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: D96063.321510.patch
Type: text/x-patch
Size: 624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210204/34978462/attachment.bin>


More information about the libcxx-commits mailing list