[libc++] Remove HIDE_FROM_ABI from virtual functions
authorLouis Dionne <ldionne.2@gmail.com>
Wed, 21 Dec 2022 15:08:54 +0000 (10:08 -0500)
committerLouis Dionne <ldionne.2@gmail.com>
Mon, 9 Jan 2023 15:29:42 +0000 (10:29 -0500)
commit5efc81166d869a94318134bbb1878b551503d115
treeedf4942c7a56865e249f8119da31dbd8f7c4f5a6
parent2dcbd740eee0283e76d08a8b646a7b5a8fbf969c
[libc++] Remove HIDE_FROM_ABI from virtual functions

_LIBCPP_HIDE_FROM_ABI (which is what _LIBCPP_INLINE_VISIBILITY is) uses
ABI tags to avoid ODR violations when linking together object files
compiled against different versions of libc++. However, pointer
authentication uses the mangled name of the function to sign the
function pointer in the vtable, which means that the ABI tag effectively
changes how the pointers are signed.

This leads to PAC failures when passing an object that holds one of these
pointers in its vtable across an ABI boundary: one side will sign the
pointer using one function mangling (with one ABI tag), and the other
side will authenticate the pointer expecting it to have a different
mangled name, which won't work.

To make sure this does not regress in the future, this patch also adds
a clang-query test to detect incorrect applications of _LIBCPP_HIDE_FROM_ABI.

Differential Revision: https://reviews.llvm.org/D140453
libcxx/include/__config
libcxx/include/__filesystem/filesystem_error.h
libcxx/include/__functional/function.h
libcxx/include/__memory/shared_ptr.h
libcxx/include/future
libcxx/include/locale
libcxx/include/regex
libcxx/test/libcxx/clang_query.sh.cpp
libcxx/test/libcxx/clang_query/abi_tag_on_virtual.query [new file with mode: 0644]