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

Florian Weimer fweimer@redhat.com
Mon Jun 16 15:39:57 GMT 2025


* Yury Khrustalev:

> On Mon, Jun 16, 2025 at 03:56:10PM +0200, Florian Weimer wrote:
>> * Yury Khrustalev:
>> 
>> > Call __libc_arm_za_disable before syscall to clear ZA state of SME for the
>> > clone and clone3 syscalls.
>> 
>> These system calls are frequently called through general syscall wrapper
>> function.  Doesn't that have to be fixed as well?
>
> As far as I know, there isn't any use of syscall(__NR_clone, ...) or
> syscall (__NR_clone3, ...) in the Glibc (or any SVC in assembly that
> would use either of these syscall numbers).
>
> Userspace should ideally use the clone() function that is part of the
> Glibc API.  In case of clone3() there is no such public function.

Using clone often requires writing a callback function and longjmp'ing
out of it.  Of course, the syscall function only works for fork-style
clone, not for vfork-style and not for thread-style.

> Any direct syscall is regarded as sufficiently low level, and we presume that
> those who do that already know what they are doing and they would have to do
> all the required ABI-related preparations.

I don't think this assumption is correct.  Fork-style clone is
reasonably portable today, so it's used in quite a few places:

  <https://codesearch.debian.net/search?q=syscall.*(NR%7CSYS)_clone&literal=0>

Thanks,
Florian



More information about the Libc-alpha mailing list