Skip to content

Commit 33c1325

Browse files
authored
[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 #84573 was reviewed. The particular implementation is identical to MachO case.
1 parent 88bd507 commit 33c1325

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libcxx/src/include/overridable_function.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ _LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) no
116116
uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override);
117117
uintptr_t __ptr = reinterpret_cast<uintptr_t>(__fptr);
118118

119+
# if __has_feature(ptrauth_calls)
120+
// We must pass a void* to ptrauth_strip since it only accepts a pointer type. See full explanation above.
121+
__ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer));
122+
# endif
123+
119124
return __ptr < __start || __ptr > __end;
120125
}
121126
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)