[PATCH v3 0/2] aarch64: clear ZA state of SME before clone and clone3 syscalls

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


Insert a call to __libc_arm_za_disable() in clone and clone3 wrappers for
AArch64 in order to clear ZA state of SME. Also add a note about invoking
the clone and clone3 system calls directly via the syscall() function to
the Glibc manual.

I had to implement test for clone3() in a but hacky way, hopefully it's OK.

Calling __libc_arm_za_disable() from clone and clone3 wrappers (implemented
in assembly) would enable code that uses Glibc wrappers to remain agnostic
of the target. Where the syscall() function is used to make SYS_clone and
SYS_clone3 syscalls directly, that would already be AArch64-sepecific code
and it should be easy enough to add a call to __arm_za_disable() before the
syscall() invocation.

Passes tests on AArch64. OK for trunk?

base commit: 69f8b3e7de

---

Changes in v3:
 - Rebased on master.
 - Added documentation,
 - v2: https://patchwork.sourceware.org/project/glibc/list/?series=48383

Changes in v2:
 - Rebased on recent master.
 - v1: https://patchwork.sourceware.org/project/glibc/list/?series=47709

---

Yury Khrustalev (2):
  aarch64: clear ZA state of SME before clone and clone3 syscalls
  manual: add architecture specific note on clone and clone3 syscalls

 manual/startup.texi                      |  13 +++
 sysdeps/aarch64/Makefile                 |   7 ++
 sysdeps/aarch64/tst-sme-clone.c          |  93 +++++++++++++++
 sysdeps/aarch64/tst-sme-clone3.c         | 143 +++++++++++++++++++++++
 sysdeps/aarch64/tst-sme-helper.h         |  32 +++++
 sysdeps/aarch64/tst-sme-za-state.c       |  38 +-----
 sysdeps/unix/sysv/linux/aarch64/clone.S  |  11 ++
 sysdeps/unix/sysv/linux/aarch64/clone3.S |  11 ++
 8 files changed, 314 insertions(+), 34 deletions(-)
 create mode 100644 sysdeps/aarch64/tst-sme-clone.c
 create mode 100644 sysdeps/aarch64/tst-sme-clone3.c

-- 
2.39.5



More information about the Libc-alpha mailing list