access-softek / llvm-project

Other
0 stars 0 forks source link

[PAuth] Normalize usage of defines #48

Closed asl closed 11 months ago

asl commented 11 months ago

__arm64__ define is Apple-specific, however its usage might be misleading. It would make sense to normalize defines usage:

We need to check all usages of __arm64__ / __arm64e__ to ensure proper functionality

kovdan01 commented 11 months ago

No changes except the change already introduced in libcxx e8ecdfc3d411e5c3e4207f70f94972083e636cbf are required.

asl commented 11 months ago

But maybe we can use __has_feature check here? So, the attribute will be enabled only when pauth ABI is in use?

kovdan01 commented 11 months ago

Thanks @asl, I've added a check against __has_feature(ptrauth_calls) here 52420441eaa2ceafa9b7a4d205179f9d21d1b00f: vtable signing is unconditionally enabled when ptrauth-calls are enabled, the only thing that a user can change is whether type/address discrimination are enabled. I've also checked if other places with clang::ptrauth* attributes need to be changed - fortunately, there are no such places.