mbox

[00/15] Fix various NPTL synchronization issues

Message ID 20210930200051.1017457-1-adhemerval.zanella@linaro.org
Headers

Message

Adhemerval Zanella Sept. 30, 2021, 8 p.m. UTC
  This is an update of my previous set to fix some NPTL issues [1].
The main changes are:

  - Rebased against master.
  - Added various Florian's suggestions.

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).

It allows to both move the thread setxid internal state out of
'cancelhandling' (used on setuid() call in multi-thread information),
and remove the EXITING_BIT and TERMINATED_BIT (since 'joinstate' now
track such it).  This is done on patch 04 and 05.

Adhemerval Zanella (15):
  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: Move setxid flag out of cancelhandling
  nptl: Replace struct thread cancelhandling field
  nptl: Use exit_lock when accessing TID on pthread_getaffinity_np
  nptl: Use exit_lock when accessing TID on pthread_setaffinity
  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/Versions                        |   1 +
 nptl/allocatestack.c                 |   5 +-
 nptl/cancellation.c                  |  17 ++--
 nptl/descr.h                         |  45 +++++-----
 nptl/nptl-stack.h                    |   2 +-
 nptl/nptl_free_tcb.c                 |  26 +++---
 nptl/nptl_setxid.c                   |  55 ++++--------
 nptl/pthread_cancel.c                |  14 ++-
 nptl/pthread_clockjoin.c             |   2 +-
 nptl/pthread_create.c                | 109 ++++++++++++----------
 nptl/pthread_detach.c                |  40 ++++-----
 nptl/pthread_exit.c                  |   4 +-
 nptl/pthread_getaffinity.c           |  28 +++---
 nptl/pthread_getattr_np.c            |   2 +-
 nptl/pthread_getcpuclockid.c         |  26 +++---
 nptl/pthread_getname.c               |  45 ++++++----
 nptl/pthread_getschedparam.c         |  55 ++++++------
 nptl/pthread_join.c                  |   2 +-
 nptl/pthread_join_common.c           | 126 +++++++++-----------------
 nptl/pthread_setaffinity.c           |  25 +++---
 nptl/pthread_setname.c               |  38 +++++---
 nptl/pthread_setschedparam.c         |  51 ++++++-----
 nptl/pthread_setschedprio.c          |  45 +++++-----
 nptl/pthread_sigqueue.c              |  56 ++++++------
 nptl/pthread_testcancel.c            |  11 +--
 nptl/pthread_timedjoin.c             |   2 +-
 nptl/pthread_tryjoin.c               |  18 ++--
 nptl/tst-cleanup5.c                  | 129 +++++++++++++++++++++++++++
 nptl_db/structs.def                  |   2 +-
 nptl_db/td_thr_get_info.c            |  16 ++--
 nptl_db/td_thr_getfpregs.c           |   9 +-
 nptl_db/td_thr_getgregs.c            |   9 +-
 nptl_db/td_thr_setfpregs.c           |   9 +-
 nptl_db/td_thr_setgregs.c            |   9 +-
 sysdeps/hppa/nptl/tcb-offsets.sym    |   1 -
 sysdeps/i386/nptl/tcb-offsets.sym    |   1 -
 sysdeps/nptl/dl-tls_init_tp.c        |   4 +-
 sysdeps/nptl/libc_start_call_main.h  |   7 ++
 sysdeps/nptl/pthreadP.h              |  27 +++---
 sysdeps/pthread/Makefile             |   1 +
 sysdeps/pthread/tst-pthread-exited.c | 101 +++++++++++++++++++++
 sysdeps/pthread/tst-thrd-detach.c    |  16 ++--
 sysdeps/sh/nptl/tcb-offsets.sym      |   1 -
 sysdeps/x86_64/nptl/tcb-offsets.sym  |   4 -
 45 files changed, 706 insertions(+), 493 deletions(-)
 create mode 100644 nptl/tst-cleanup5.c
 create mode 100644 sysdeps/pthread/tst-pthread-exited.c