aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src
diff options
context:
space:
mode:
authorAnton Korobeynikov <anton@korobeynikov.info>2024-09-09 16:34:41 -0700
committerGitHub <noreply@github.com>2024-09-09 16:34:41 -0700
commit33c1325a73c4bf6bacdb865c2550038afe4377d2 (patch)
tree3cfcc31326c3431c3cd3ae3f88479198e8306be9 /libcxx/src
parent88bd507dc2dd9c235b54d718cf84e4ef80d94bc9 (diff)
downloadllvm-33c1325a73c4bf6bacdb865c2550038afe4377d2.zip
llvm-33c1325a73c4bf6bacdb865c2550038afe4377d2.tar.gz
llvm-33c1325a73c4bf6bacdb865c2550038afe4377d2.tar.bz2
[PAC] Make __is_function_overridden pauth-aware on ELF platforms (#107498)
Apparently, there are two almost identical implementations: one for MachO and another one for ELF. The ELF bits somehow slipped while https://github.com/llvm/llvm-project/pull/84573 was reviewed. The particular implementation is identical to MachO case.
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/include/overridable_function.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libcxx/src/include/overridable_function.h b/libcxx/src/include/overridable_function.h
index e83ca7b..6c70f62 100644
--- a/libcxx/src/include/overridable_function.h
+++ b/libcxx/src/include/overridable_function.h
@@ -116,6 +116,11 @@ _LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) no
uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override);
uintptr_t __ptr = reinterpret_cast<uintptr_t>(__fptr);
+# if __has_feature(ptrauth_calls)
+ // We must pass a void* to ptrauth_strip since it only accepts a pointer type. See full explanation above.
+ __ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer));
+# endif
+
return __ptr < __start || __ptr > __end;
}
_LIBCPP_END_NAMESPACE_STD