Skip to content

Commit ce0641d

Browse files
brooniectmarinas
authored andcommitted
arm64/sysreg: Add definitions for architected GCS caps
The architecture defines a format for guarded control stack caps, used to mark the top of an unused GCS in order to limit the potential for exploitation via stack switching. Add definitions associated with these. Reviewed-by: Thiago Jung Bauermann <[email protected]> Acked-by: Catalin Marinas <[email protected]> Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 7058bf8 commit ce0641d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,26 @@
11011101
/* Initial value for Permission Overlay Extension for EL0 */
11021102
#define POR_EL0_INIT POE_RXW
11031103

1104+
/*
1105+
* Definitions for Guarded Control Stack
1106+
*/
1107+
1108+
#define GCS_CAP_ADDR_MASK GENMASK(63, 12)
1109+
#define GCS_CAP_ADDR_SHIFT 12
1110+
#define GCS_CAP_ADDR_WIDTH 52
1111+
#define GCS_CAP_ADDR(x) FIELD_GET(GCS_CAP_ADDR_MASK, x)
1112+
1113+
#define GCS_CAP_TOKEN_MASK GENMASK(11, 0)
1114+
#define GCS_CAP_TOKEN_SHIFT 0
1115+
#define GCS_CAP_TOKEN_WIDTH 12
1116+
#define GCS_CAP_TOKEN(x) FIELD_GET(GCS_CAP_TOKEN_MASK, x)
1117+
1118+
#define GCS_CAP_VALID_TOKEN 0x1
1119+
#define GCS_CAP_IN_PROGRESS_TOKEN 0x5
1120+
1121+
#define GCS_CAP(x) ((((unsigned long)x) & GCS_CAP_ADDR_MASK) | \
1122+
GCS_CAP_VALID_TOKEN)
1123+
11041124
#define ARM64_FEATURE_FIELD_BITS 4
11051125

11061126
/* Defined for compatibility only, do not add new users. */

0 commit comments

Comments
 (0)