[RFC PATCH 1/9] arm64: assembler: enable PAC for non-leaf assembler routines

Ard Biesheuvel ardb at kernel.org
Wed Oct 13 08:22:35 PDT 2021


Enable pointer signing and authentication when preserving and restoring
the linker register to/from the stack for assembler routines that use
the frame_push and frame_pop macros to set up their stack frames. This
protects the return address from inadvertent modification while stored
in memory.

Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
 arch/arm64/include/asm/assembler.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index 89faca0e740d..ceed84ac4005 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -665,6 +665,9 @@ alternative_endif
 	 *              for locals.
 	 */
 	.macro		frame_push, regcount:req, extra
+#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL
+	paciasp
+#endif
 	__frame		st, \regcount, \extra
 	.endm
 
@@ -676,6 +679,9 @@ alternative_endif
 	 */
 	.macro		frame_pop
 	__frame		ld
+#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL
+	autiasp
+#endif
 	.endm
 
 	.macro		__frame_regs, reg1, reg2, op, num
-- 
2.30.2




More information about the linux-arm-kernel mailing list