Fix invalid check for valid key of Pointer Authentication

Arm's Pointer Authentication uses two keys for signing pointers, A-key
and B-key. Although by default Clang uses the A-key if PAC support is
enabled at compile time, this behaviour might be overridden via compiler
command line.

This CL fixes the check for the B-key being enabled. The key that shall
be used for Pointer Authentication is denoted by bits 0 (A-key) or
1 (B-key) of __ARM_FEATURE_PAC_DEFAULT. Hence, the previous way of
checking by using bits 0 and 2 does not correctly identify the B-key.

Bug: 40608466
Change-Id: Ib2f226baa12a7145fa0b6e486e49d36e6b0a3cd7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5341090
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
André Kempe 2024-03-05 08:38:47 +00:00 committed by Crashpad LUCI CQ
parent dea283a7eb
commit 6bf5e1b5c5

View File

@ -34,7 +34,7 @@
#endif
#if defined(__ARM_FEATURE_PAC_DEFAULT)
#if ((__ARM_FEATURE_PAC_DEFAULT & ((1<<0)|(1<<2))) == 0)
#if ((__ARM_FEATURE_PAC_DEFAULT & ((1<<0)|(1<<1))) == 0)
#error Pointer authentication defines no valid key!
#endif
#define GNU_PROPERTY_AARCH64_PAC 1 // Has PAC