[PATCH 0/3] Fix robust mutex support detection

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Jul 29 18:21:26 GMT 2025


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.

[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                                 |  1 +
 nptl/Versions                                 |  1 -
 nptl/allocatestack.c                          |  9 +----
 nptl/descr.h                                  | 32 ++++++++++++++++
 nptl/nptl_robust_setup.c                      | 38 +++++++++++++++++++
 nptl/pthread_create.c                         | 12 ------
 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                          |  4 +-
 nptl/tst-robust-fork.c                        | 21 ++++++++++
 support/Makefile                              |  1 +
 support/support_mutex_robust.c                | 34 +++++++++++++++++
 support/xthread.h                             |  3 ++
 sysdeps/nptl/dl-tls_init_tp.c                 | 23 +----------
 sysdeps/nptl/pthreadP.h                       |  8 +---
 sysdeps/pthread/tst-mutex7.c                  |  3 ++
 sysdeps/pthread/tst-robust1.c                 |  3 ++
 sysdeps/pthread/tst-robust10.c                |  3 ++
 sysdeps/pthread/tst-robust7.c                 |  2 +
 sysdeps/pthread/tst-robust8.c                 |  6 +++
 sysdeps/pthread/tst-robust9.c                 |  2 +
 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 ---
 30 files changed, 163 insertions(+), 91 deletions(-)
 create mode 100644 nptl/nptl_robust_setup.c
 create mode 100644 support/support_mutex_robust.c

-- 
2.43.0



More information about the Libc-alpha mailing list