[PATCH v4 1/2] aarch64: clear ZA state of SME before clone and clone3

Yury Khrustalev yury.khrustalev@arm.com
Tue Sep 23 16:04:18 GMT 2025


Sorry, my bad

On Tue, Sep 23, 2025 at 04:50:19PM +0100, Yury Khrustalev wrote:
> On Tue, Sep 23, 2025 at 11:56:37AM -0300, Adhemerval Zanella Netto wrote:
> ...
> > And this patch also does *not* change fork()/_Fork() to follow this new semantic 
> > because it does not use __clone internally.  On Linux, fork() will call:
> > 
> > posix/fork.c:                             __libc_fork
> > sysdeps/nptl/_Fork.c:                     \_ _Fork
> > sysdeps/unix/sysv/linux/arch-fork.h:         \_ arch_fork
> > sysdeps/unix/sysv/linux/aarch64/sysdep.h:       \_ INLINE_SYSCALL_CALL
> 
> It seems that SYS_clone (220) is called on AArch64, e.g. for the
> ./elf/tst-align2 test:
> 
> (gdb) bt
> #0  arch_fork (ctid=ctid@entry=0xfffff7ff40f0) at ../sysdeps/unix/sysv/linux/arch-fork.h:43
> #1  0x0000fffff7e9df04 in __GI__Fork () at ../sysdeps/nptl/_Fork.c:33
> #2  0x0000fffff7ea2658 in __libc_fork () at fork.c:75
> #3  0x0000aaaaaaaa2a40 in support_test_main (...) at support_test_main.c:434
> #4  0x0000aaaaaaaa20ac in main (...) at ../support/test-driver.c:171
> #5  0x0000fffff7e11ed4 in __libc_start_call_main (...) at ../sysdeps/nptl/libc_start_call_main.h:58
> #6  0x0000fffff7e11f98 in __libc_start_main_impl (...) at ../csu/libc-start.c:360
> #7  0x0000aaaaaaaa1a70 in _start () at ../sysdeps/aarch64/start.S:100
> (gdb) disassemble 
> Dump of assembler code for function arch_fork:
>    <+0>:	mov	x4, x0
> => <+4>:	mov	x0, #0x11                  	// #17
>    <+8>:	movk	x0, #0x120, lsl #16
>    <+12>:	mov	x1, #0x0                   	// #0
>    <+16>:	mov	x2, #0x0                   	// #0
>    <+20>:	mov	x3, #0x0                   	// #0
>    <+24>:	mov	x8, #0xdc                  	// #220 <=== SYS_clone
>    <+28>:	svc	#0x0
>    <+32>:	cmn	x0, #0x1, lsl #12

This is not using the wrapper, so yeah, good point, this would have to
be fixed too with added call to __arm_za_disable().




More information about the Libc-alpha mailing list