aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrea Corallo <andrea.corallo@arm.com>2021-12-06 11:42:11 +0100
committerAndrea Corallo <andrea.corallo@arm.com>2023-01-23 11:28:11 +0100
commit7161afc778699b90edafbcd750b2e185a1de00a6 (patch)
treea70f35995eac4ee621970c49e84c3105c56b46ee /gcc
parentdffcafd88ced273fb0b2e8b754b44472d73458f7 (diff)
downloadgcc-7161afc778699b90edafbcd750b2e185a1de00a6.zip
gcc-7161afc778699b90edafbcd750b2e185a1de00a6.tar.gz
gcc-7161afc778699b90edafbcd750b2e185a1de00a6.tar.bz2
[PATCH 6/15] arm: Add pointer authentication for stack-unwinding runtime
This patch adds authentication for when the stack is unwound when an exception is taken. All the changes here are done to the runtime code in libgcc's unwinder code for Arm target. All the changes are guarded under defined (__ARM_FEATURE_PAC_DEFAULT) and activated only if the +pacbti feature is switched on for the architecture. This means that switching on the target feature via -march or -mcpu is sufficient and -mbranch-protection need not be enabled. This ensures that the unwinder is authenticated only if the PACBTI instructions are available in the non-NOP space as it uses AUTG. Just generating PAC/AUT instructions using -mbranch-protection will not enable authentication on the unwinder. Pre-approved with the requested changes here <https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586555.html>. gcc/ChangeLog: * ginclude/unwind-arm-common.h (_Unwind_VRS_RegClass): Introduce new pseudo register class _UVRSC_PAC. libgcc/ChangeLog: * config/arm/pr-support.c (__gnu_unwind_execute): Decode exception opcode (0xb4) for saving RA_AUTH_CODE and authenticate with AUTG if found. * config/arm/unwind-arm.c (struct pseudo_regs): New. (phase1_vrs): Introduce new field to store pseudo-reg state. (phase2_vrs): Likewise. (_Unwind_VRS_Get): Load pseudo register state from virtual reg set. (_Unwind_VRS_Set): Store pseudo register state to virtual reg set. (_Unwind_VRS_Pop): Load pseudo register value from stack into VRS. Co-Authored-By: Tejas Belagod <tbelagod@arm.com> Co-Authored-By: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ginclude/unwind-arm-common.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ginclude/unwind-arm-common.h b/gcc/ginclude/unwind-arm-common.h
index a2ef868..3ee0a6b 100644
--- a/gcc/ginclude/unwind-arm-common.h
+++ b/gcc/ginclude/unwind-arm-common.h
@@ -127,7 +127,8 @@ extern "C" {
_UVRSC_VFP = 1, /* vfp */
_UVRSC_FPA = 2, /* fpa */
_UVRSC_WMMXD = 3, /* Intel WMMX data register */
- _UVRSC_WMMXC = 4 /* Intel WMMX control register */
+ _UVRSC_WMMXC = 4, /* Intel WMMX control register */
+ _UVRSC_PAC = 5 /* Armv8.1-M Mainline PAC/AUTH pseudo-register */
}
_Unwind_VRS_RegClass;