Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109447084
D42225.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D42225.diff
View Options
diff --git a/sys/arm64/include/asm.h b/sys/arm64/include/asm.h
--- a/sys/arm64/include/asm.h
+++ b/sys/arm64/include/asm.h
@@ -142,6 +142,58 @@
#define BTI_J
#endif
+/*
+ * GNU_PROPERTY_AARCH64_FEATURE_1_NOTE can be used to insert a note that
+ * the current assembly file is built with Pointer Authentication (PAC) or
+ * Branch Target Identification support (BTI). As the linker requires all
+ * object files in an executable or library to have the GNU property
+ * note to emit it in the created elf file we need to add a note to all
+ * assembly files that support BTI so the kernel and dynamic linker can
+ * mark memory used by the file as guarded.
+ *
+ * The GNU_PROPERTY_AARCH64_FEATURE_1_VAL macro encodes the combination
+ * of PAC and BTI that have been enabled. It can be used as follows:
+ * GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL);
+ *
+ * To use this you need to include <sys/elf_common.h> for
+ * GNU_PROPERTY_AARCH64_FEATURE_1_*
+ */
+#if defined(__ARM_FEATURE_BTI_DEFAULT)
+#if defined(__ARM_FEATURE_PAC_DEFAULT)
+/* BTI, PAC */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_VAL \
+ (GNU_PROPERTY_AARCH64_FEATURE_1_BTI | GNU_PROPERTY_AARCH64_FEATURE_1_PAC)
+#else
+/* BTI, no PAC */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_VAL \
+ (GNU_PROPERTY_AARCH64_FEATURE_1_BTI)
+#endif
+#elif defined(__ARM_FEATURE_PAC_DEFAULT)
+/* No BTI, PAC */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_VAL \
+ (GNU_PROPERTY_AARCH64_FEATURE_1_PAC)
+#else
+/* No BTI, no PAC */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_VAL 0
+#endif
+
+#if defined(__ARM_FEATURE_BTI_DEFAULT) || defined(__ARM_FEATURE_PAC_DEFAULT)
+#define GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(x) \
+ .section .note.gnu.property, "a"; \
+ .balign 8; \
+ .4byte 0x4; /* sizeof(vendor) */ \
+ .4byte 0x10; /* sizeof(note data) */ \
+ .4byte (NT_GNU_PROPERTY_TYPE_0); \
+ .asciz "GNU"; /* vendor */ \
+ /* note data: */ \
+ .4byte (GNU_PROPERTY_AARCH64_FEATURE_1_AND); \
+ .4byte 0x4; /* sizeof(property) */ \
+ .4byte (x); /* property */ \
+ .4byte 0
+#else
+#define GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(x)
+#endif
+
#endif /* _MACHINE_ASM_H_ */
#endif /* !__arm__ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 4:37 AM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16487083
Default Alt Text
D42225.diff (2 KB)
Attached To
Mode
D42225: arm64: Support creating a BTI & PAC note
Attached
Detach File
Event Timeline
Log In to Comment