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

Yury Khrustalev yury.khrustalev@arm.com
Fri Jun 20 13:15:23 GMT 2025


Hi everyone,

Replying here including everyone involved in multiple sub-threads that
originated from this patch.

There's been a lot of comments on whether we need to call the Glibc's
equivalent of __arm_za_disable() in the assembly wrappers that Glibc
has for SYS_clone and SYS_clone3 system calls for the AArch64 target.

The gist of it is that it's difficult to reliably work out when this
function may not be called, while calling it would be NOP when it is
not needed, hence it's correct to call it to ensure that whatever state
is produced as a result of a subsequent system call is consistent with
respect to SME specifics.

One particular comment from Florian about cases when the aforementioned
system calls are invoked directly via the syscall() function was spot on.
Indeed, there are many usages of SYS_clone like that.

For this, I believe, we should do the following. Where SYS_clone (and
possibly SYS_clone3 in the future) are used via the Glibc wrapper, we
should help people write portable code, and therefore we should take
care of any architecture-specific nuances in the implementation of the
corresponding wrappers. Where the syscall() function is used, this would
already be target-specific code, and the author of such code would need
to be aware of any additional requirements and would have to take care
of them manually (in this case by using the architecture-specific function
__arm_za_disable() before invoking syscall()).

Just make things explicit, I will add a section on this to the Glibc manual.
This should also be described in Documentation/arch/arm64/sme.rst on the
kernel side at some point.

Will be sending v3 shortly.

Hope this helps,
Yury



More information about the Libc-alpha mailing list