[clang] [clang] Add arm64e ABI-defined key assignments to ptrauth.h. (PR #93901)
Ahmed Bougacha via cfe-commits
cfe-commits at lists.llvm.org
Fri May 31 13:00:35 PDT 2024
https://github.com/ahmedbougacha updated https://github.com/llvm/llvm-project/pull/93901
>From fc8f76b404b25951dc10ecaaa760b4b4c3d4f858 Mon Sep 17 00:00:00 2001
From: Ahmed Bougacha <ahmed at bougacha.org>
Date: Thu, 30 May 2024 17:07:04 -0700
Subject: [PATCH 1/2] [clang] Add arm64e ABI-defined key assignments to
ptrauth.h.
These are currently gated by __APPLE__; we can figure out a way to
define these on ELF targets as well, and maybe have them be defined
by clang itself, depending on ABI modes.
---
clang/lib/Headers/ptrauth.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/clang/lib/Headers/ptrauth.h b/clang/lib/Headers/ptrauth.h
index 56c3c3636c9bc..036665d75a91b 100644
--- a/clang/lib/Headers/ptrauth.h
+++ b/clang/lib/Headers/ptrauth.h
@@ -15,6 +15,29 @@ typedef enum {
ptrauth_key_asib = 1,
ptrauth_key_asda = 2,
ptrauth_key_asdb = 3,
+
+#ifdef __APPLE__
+ /* A process-independent key which can be used to sign code pointers.
+ Signing and authenticating with this key is a no-op in processes
+ which disable ABI pointer authentication. */
+ ptrauth_key_process_independent_code = ptrauth_key_asia,
+
+ /* A process-specific key which can be used to sign code pointers.
+ Signing and authenticating with this key is enforced even in processes
+ which disable ABI pointer authentication. */
+ ptrauth_key_process_dependent_code = ptrauth_key_asib,
+
+ /* A process-independent key which can be used to sign data pointers.
+ Signing and authenticating with this key is a no-op in processes
+ which disable ABI pointer authentication. */
+ ptrauth_key_process_independent_data = ptrauth_key_asda,
+
+ /* A process-specific key which can be used to sign data pointers.
+ Signing and authenticating with this key is a no-op in processes
+ which disable ABI pointer authentication. */
+ ptrauth_key_process_dependent_data = ptrauth_key_asdb,
+#endif /* __APPLE__ */
+
} ptrauth_key;
/* An integer type of the appropriate size for a discriminator argument. */
>From 235f85f988c32c0efd3861ed15810441dcfeb07e Mon Sep 17 00:00:00 2001
From: Ahmed Bougacha <ahmed at bougacha.org>
Date: Fri, 31 May 2024 12:52:41 -0700
Subject: [PATCH 2/2] Don't gate by __APPLE__, remove darwin-specific comments.
---
clang/lib/Headers/ptrauth.h | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/clang/lib/Headers/ptrauth.h b/clang/lib/Headers/ptrauth.h
index 036665d75a91b..a9d182aa24470 100644
--- a/clang/lib/Headers/ptrauth.h
+++ b/clang/lib/Headers/ptrauth.h
@@ -16,27 +16,17 @@ typedef enum {
ptrauth_key_asda = 2,
ptrauth_key_asdb = 3,
-#ifdef __APPLE__
- /* A process-independent key which can be used to sign code pointers.
- Signing and authenticating with this key is a no-op in processes
- which disable ABI pointer authentication. */
+ /* A process-independent key which can be used to sign code pointers. */
ptrauth_key_process_independent_code = ptrauth_key_asia,
- /* A process-specific key which can be used to sign code pointers.
- Signing and authenticating with this key is enforced even in processes
- which disable ABI pointer authentication. */
+ /* A process-specific key which can be used to sign code pointers. */
ptrauth_key_process_dependent_code = ptrauth_key_asib,
- /* A process-independent key which can be used to sign data pointers.
- Signing and authenticating with this key is a no-op in processes
- which disable ABI pointer authentication. */
+ /* A process-independent key which can be used to sign data pointers. */
ptrauth_key_process_independent_data = ptrauth_key_asda,
- /* A process-specific key which can be used to sign data pointers.
- Signing and authenticating with this key is a no-op in processes
- which disable ABI pointer authentication. */
+ /* A process-specific key which can be used to sign data pointers. */
ptrauth_key_process_dependent_data = ptrauth_key_asdb,
-#endif /* __APPLE__ */
} ptrauth_key;
More information about the cfe-commits
mailing list