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

From
Ard Biesheuvel <ardb@kernel.org>
Date
2021-10-13 15:25:27
Also in
linux-hardening
Reply to
Ard Biesheuvel, 2021-10-13
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 --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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (16 messages) 16 messages, 4 authors, last reply 2021-10-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help