[glibc/release/2.41/master] aarch64: Disable ZA state of SME in setjmp and sigsetjmp

Yury Khrustalev ykhrustalev@sourceware.org
Mon Nov 10 14:03:06 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1f57ffdf35334ab245544cbb88f3abf2e6c77c54

commit 1f57ffdf35334ab245544cbb88f3abf2e6c77c54
Author: Yury Khrustalev <yury.khrustalev@arm.com>
Date:   Mon Apr 28 15:12:04 2025 +0100

    aarch64: Disable ZA state of SME in setjmp and sigsetjmp
    
    Due to the nature of the ZA state, setjmp() should clear it in the
    same manner as it is already done by longjmp.
    
    Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
    (cherry picked from commit a7f6fd976c17b82dc198290b4ab7087f35855a0e)

Diff:
---
 sysdeps/aarch64/setjmp.S | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index b630ca099a..f8845fcb8f 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -37,6 +37,29 @@ ENTRY (__sigsetjmp)
 	PTR_ARG (0)
 
 1:
+
+#if IS_IN(libc)
+	/* Disable ZA state of SME in libc.a and libc.so, but not in ld.so.  */
+# if HAVE_AARCH64_PAC_RET
+	PACIASP
+	cfi_window_save
+# endif
+	stp	x29, x30, [sp, -16]!
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (x29, 0)
+	cfi_rel_offset (x30, 8)
+	mov	x29, sp
+	bl	__libc_arm_za_disable
+	ldp	x29, x30, [sp], 16
+	cfi_adjust_cfa_offset (-16)
+	cfi_restore (x29)
+	cfi_restore (x30)
+# if HAVE_AARCH64_PAC_RET
+	AUTIASP
+	cfi_window_save
+# endif
+#endif
+
 	stp	x19, x20, [x0, #JB_X19<<3]
 	stp	x21, x22, [x0, #JB_X21<<3]
 	stp	x23, x24, [x0, #JB_X23<<3]


More information about the Glibc-cvs mailing list