[all-commits] [llvm/llvm-project] 5efc81: [libc++] Remove HIDE_FROM_ABI from virtual functions

Louis Dionne via All-commits all-commits at lists.llvm.org
Mon Jan 9 07:29:55 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5efc81166d869a94318134bbb1878b551503d115
      https://github.com/llvm/llvm-project/commit/5efc81166d869a94318134bbb1878b551503d115
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2023-01-09 (Mon, 09 Jan 2023)

  Changed paths:
    M libcxx/include/__config
    M libcxx/include/__filesystem/filesystem_error.h
    M libcxx/include/__functional/function.h
    M libcxx/include/__memory/shared_ptr.h
    M libcxx/include/future
    M libcxx/include/locale
    M libcxx/include/regex
    M libcxx/test/libcxx/clang_query.sh.cpp
    A libcxx/test/libcxx/clang_query/abi_tag_on_virtual.query

  Log Message:
  -----------
  [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




More information about the All-commits mailing list