diff mbox series

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

Message ID 20211013152243.2216899-2-ardb@kernel.org (mailing list archive)
State RFC
Headers show
Series arm64: use unwind data on GCC for shadow call stack | expand

Commit Message

Ard Biesheuvel Oct. 13, 2021, 3:22 p.m. UTC
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@kernel.org>
---
 arch/arm64/include/asm/assembler.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

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