mbox series

[v3,00/12] Fix various NPTL synchronization issues

Message ID 20220531175255.1513396-1-adhemerval.zanella@linaro.org
Headers show
Series Fix various NPTL synchronization issues | expand

Message

Adhemerval Zanella Netto May 31, 2022, 5:52 p.m. UTC
Patch 01 is a conformance fix to set both the cancellation type
and status on thread pthread_exit. 

Patch 02 fixes a potential issue with robust mutexes on architectures
without a working set_rebust_list syscall.

Patch 03 is the main change of this patchset, it uses a different
field instead of the pthread 'tid' to synchrnonize the internal
thread state (BZ#19951).

Patches 04 to 12 extend the same 'tid' access fix to other pthread
functions that uses the member.

Changes in v3:
 
* Rebased against master.
* Return EINVAL instead of ESRCH for invalid pthread_t on getters
  and setters.

Adhemerval Zanella (12):
  nptl: Set cancellation type and state on pthread_exit (BZ #28267)
  nptl: Handle robust PI mutexes for !__ASSUME_SET_ROBUST_LIST (BZ
    #28268)
  nptl: Do not use pthread set_tid_address as state synchronization (BZ
    #19951)
  nptl: Use exit_lock when accessing TID on pthread_getaffinity_np
  nptl: Use exit_lock when accessing TID on pthread_getcpuclockid
  nptl: Use exit_lock when accessing TID on pthread_setschedparam
  nptl: Use exit_lock when accessing TID on pthread_getschedparam
  nptl: Use exit_lock when accessing TID on pthread_getname_np
  nptl: Use exit_lock when accessing TID on pthread_setname_np
  nptl: Use exit_lock when accessing TID on pthread_sigqueue
  nptl: Use exit_lock when accessing TID on pthread_setschedprio
  nptl: Remove INVALID_TD_P

 nptl/Makefile                        |   3 +-
 nptl/cancellation.c                  |  31 ++++++-
 nptl/descr.h                         |  26 +++---
 nptl/nptl-stack.h                    |   2 +-
 nptl/pthread_cancel.c                |   4 +-
 nptl/pthread_clockjoin.c             |   2 +-
 nptl/pthread_create.c                |  96 ++++++++++++--------
 nptl/pthread_detach.c                |  40 ++++-----
 nptl/pthread_exit.c                  |   4 +-
 nptl/pthread_getaffinity.c           |  30 ++++---
 nptl/pthread_getattr_np.c            |   2 +-
 nptl/pthread_getcpuclockid.c         |  26 +++---
 nptl/pthread_getname.c               |  65 ++++++++------
 nptl/pthread_getschedparam.c         |  55 ++++++------
 nptl/pthread_join.c                  |   2 +-
 nptl/pthread_join_common.c           | 124 +++++++++----------------
 nptl/pthread_setname.c               |  52 ++++++-----
 nptl/pthread_setschedparam.c         |  51 ++++++-----
 nptl/pthread_setschedprio.c          |  45 +++++-----
 nptl/pthread_sigqueue.c              |  56 ++++++------
 nptl/pthread_testcancel.c            |   5 +-
 nptl/pthread_timedjoin.c             |   2 +-
 nptl/pthread_tryjoin.c               |  18 ++--
 nptl/tst-cleanup5.c                  | 129 +++++++++++++++++++++++++++
 sysdeps/nptl/dl-tls_init_tp.c        |   4 +-
 sysdeps/nptl/libc_start_call_main.h  |   7 ++
 sysdeps/nptl/pthreadP.h              |  22 ++---
 sysdeps/pthread/Makefile             |   1 +
 sysdeps/pthread/tst-pthread-exited.c |  94 +++++++++++++++++++
 sysdeps/pthread/tst-thrd-detach.c    |  16 ++--
 30 files changed, 642 insertions(+), 372 deletions(-)
 create mode 100644 nptl/tst-cleanup5.c
 create mode 100644 sysdeps/pthread/tst-pthread-exited.c