[PATCH v2 0/3] Fix robust mutex support detection

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Jul 29 17:46:35 GMT 2026


An issue reported by qemu [1] states that programs using process-shared
robust mutexes fail on qemu-user for riscv64 while succeeding for
x86_64/aarch64.  However, qemu-user does not implement set_robust_list
for any architecture in user-mode, meaning that its usage should fail
for all architectures.

While checking the robust mutex support, I also discovered that we can
move the kernel initialization only when process-shared robust mutexes
are used, instead of on every process/thread initialization.

Changes from v1:

* Fixed the userspace robust list cleanup for PI mutextes.
* tst-mutexpi10 now skips on ENOTSUP regardless of the robust
  attribute.
* __nptl_set_robust_list_avail is read and written with relaxed
  atomics, and robust_list_setup returns early once set_robust_list is
  known not to work.

[1] https://gitlab.com/qemu-project/qemu/-/issues/3044

Adhemerval Zanella (3):
  support: Add support_process_shared_robust_mutex
  nptl: Do not always assume set_robust_list availability (BZ 33225)
  nptl: Only initialize robust list at mutex usage

 nptl/Makefile                                 |  2 +
 nptl/Versions                                 |  1 -
 nptl/allocatestack.c                          |  9 +-
 nptl/descr.h                                  | 46 ++++++++++
 nptl/nptl_robust_setup.c                      | 38 ++++++++
 nptl/pthread_create.c                         | 67 ++++++++------
 nptl/pthread_mutex_init.c                     |  5 +-
 nptl/pthread_mutex_lock.c                     |  2 +
 nptl/pthread_mutex_timedlock.c                |  2 +
 nptl/pthread_mutex_trylock.c                  |  2 +
 nptl/tst-mutexpi10.c                          |  7 +-
 nptl/tst-robust-fork.c                        | 21 +++++
 nptl/tst-robust-pshared.c                     | 91 +++++++++++++++++++
 support/Makefile                              |  1 +
 support/support_mutex_robust.c                | 34 +++++++
 support/xthread.h                             |  3 +
 sysdeps/nptl/_Fork.c                          | 24 ++---
 sysdeps/nptl/dl-tls_init_tp.c                 | 23 +----
 sysdeps/nptl/pthreadP.h                       |  7 --
 sysdeps/pthread/tst-robust8.c                 |  6 ++
 sysdeps/unix/sysv/linux/arm/kernel-features.h |  7 --
 .../unix/sysv/linux/hppa/kernel-features.h    |  3 -
 sysdeps/unix/sysv/linux/kernel-features.h     |  5 -
 .../unix/sysv/linux/m68k/kernel-features.h    |  5 -
 .../unix/sysv/linux/mips/kernel-features.h    |  6 --
 .../unix/sysv/linux/riscv/kernel-features.h   |  5 -
 .../unix/sysv/linux/sparc/kernel-features.h   |  6 --
 27 files changed, 307 insertions(+), 121 deletions(-)
 create mode 100644 nptl/nptl_robust_setup.c
 create mode 100644 nptl/tst-robust-pshared.c
 create mode 100644 support/support_mutex_robust.c

-- 
2.53.0



More information about the Libc-alpha mailing list