mbox series

[v2,00/21] nptl: Fix Race conditions in pthread cancellation (BZ#12683)

Message ID 1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org
Headers show
Series nptl: Fix Race conditions in pthread cancellation (BZ#12683) | expand

Message

Adhemerval Zanella Feb. 26, 2018, 9:03 p.m. UTC
Changes from previous version [1]:

  * Rebase againt master to incorporate the pthread_join consolidation.

  * Remove ARM syscall_cancel.S implementation and make it use default
    one instead.

  * Move the powerpc syscall stackframe to its own patch.

  * Added a RISCV port using generic syscall_cancel implementation.

I currently tested on x86_64-linux-gnu, x86_64-linux-gnu-x32, i686-linux-gnu,
arm-linux-gnueabihf, aarch64-linux-gnu, sparcv9-linux-gnu, sparc64-linux-gnu,
alpha-linux-gnu, and hppa-linux-gnu.  I also did some simple tests on
ia64-linux-gnu and mips{64}-linux-gnu (to check for the correctness in the
syscall wrapper implementation).  For the rest of support architectures
I just did a cross build/check.

[1] https://sourceware.org/ml/libc-alpha/2017-12/msg00314.html

Adhemerval Zanella (21):
  powerpc: Create stackframe information on syscall
  nptl: Fix testcases for new pthread cancellation mechanism
  nptl: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: x86_64: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: x32: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: i386: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: powerpc: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: aarch64: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: s390: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: ia64: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: alpha: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: m68k: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: microblaze: Fix Race conditions in pthread cancellation
    (BZ#12683)
  nptl: tile: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: sparc: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: nios2: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: sh: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: mips: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: hppa: Fix Race conditions in pthread cancellation (BZ#12683)
  nptl: riscv: Fix Race conditions in pthread cancellation (BZ#12683)

 ChangeLog                                          | 216 +++++++++++++++++++++
 debug/tst-backtrace5.c                             |  28 +--
 include/libc-pointer-arith.h                       |  16 +-
 io/creat.c                                         |   3 -
 io/ppoll.c                                         |   2 -
 manual/llio.texi                                   |   4 +-
 misc/pselect.c                                     |   2 -
 nptl/Makefile                                      |  25 +--
 nptl/Versions                                      |   3 +
 nptl/cancellation.c                                | 101 ----------
 nptl/descr.h                                       |  15 +-
 nptl/libc-cancellation.c                           |  48 ++++-
 nptl/lll_timedlock_wait.c                          |   2 +-
 nptl/lll_timedwait_tid.c                           |   3 +-
 nptl/nptl-init.c                                   |  78 +++++---
 nptl/pthreadP.h                                    |  74 +++----
 nptl/pthread_cancel.c                              |  68 ++-----
 nptl/pthread_create.c                              |   7 +-
 nptl/pthread_exit.c                                |   9 +-
 nptl/pthread_join_common.c                         |   7 +-
 nptl/sem_wait.c                                    |   8 +-
 nptl/tst-cancel-wrappers.sh                        |  92 ---------
 nptl/tst-cancel2.c                                 |   3 -
 nptl/tst-cancel28.c                                |  94 +++++++++
 nptl/tst-cancel3.c                                 |   3 -
 nptl/tst-cancel4.c                                 |   8 +
 rt/Makefile                                        |   1 -
 support/temp_file.c                                |  23 +++
 support/temp_file.h                                |   6 +
 sysdeps/generic/sigcontextinfo.h                   |  15 ++
 sysdeps/generic/sysdep-cancel.h                    |   3 -
 sysdeps/i386/nptl/tls.h                            |  11 --
 sysdeps/mips/nptl/tls.h                            |   2 +-
 sysdeps/nptl/Makefile                              |   3 +-
 sysdeps/nptl/aio_misc.h                            |  13 +-
 sysdeps/nptl/gai_misc.h                            |  13 +-
 sysdeps/nptl/lowlevellock.h                        |   5 +-
 sysdeps/posix/open64.c                             |  12 +-
 sysdeps/posix/pause.c                              |   2 -
 sysdeps/posix/sigpause.c                           |   3 -
 sysdeps/posix/sigwait.c                            |   9 +-
 sysdeps/posix/waitid.c                             |  11 +-
 sysdeps/sh/sysdep.h                                |   1 +
 sysdeps/sparc/sparc32/lowlevellock.c               |   3 +-
 sysdeps/unix/sysdep.h                              | 118 +++++++++--
 sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |  11 ++
 sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h     |  13 ++
 sysdeps/unix/sysv/linux/arm/Makefile               |   3 +
 sysdeps/unix/sysv/linux/arm/sigcontextinfo.h       |  12 ++
 sysdeps/unix/sysv/linux/clock_nanosleep.c          |  20 +-
 sysdeps/unix/sysv/linux/creat.c                    |   2 -
 sysdeps/unix/sysv/linux/creat64.c                  |   2 -
 sysdeps/unix/sysv/linux/futex-internal.h           |  18 +-
 .../sysv/linux/hppa/sigcontextinfo.h}              |  26 ++-
 sysdeps/unix/sysv/linux/hppa/syscall_cancel.S      |  82 ++++++++
 sysdeps/unix/sysv/linux/i386/Makefile              |   2 +-
 sysdeps/unix/sysv/linux/i386/lowlevellock.h        |   2 +-
 sysdeps/unix/sysv/linux/i386/sigcontextinfo.h      |  13 ++
 sysdeps/unix/sysv/linux/i386/syscall_cancel.S      | 107 ++++++++++
 sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h      |  24 +++
 sysdeps/unix/sysv/linux/ia64/syscall_cancel.S      |  94 +++++++++
 sysdeps/unix/sysv/linux/lowlevellock-futex.h       |  34 +++-
 sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h      |  13 ++
 .../unix/sysv/linux/microblaze/sigcontextinfo.h    |  13 ++
 .../unix/sysv/linux/microblaze/syscall_cancel.S    |  62 ++++++
 .../unix/sysv/linux/mips/mips32/syscall_cancel.S   | 128 ++++++++++++
 sysdeps/unix/sysv/linux/mips/mips32/sysdep.h       |   4 +
 sysdeps/unix/sysv/linux/mips/sigcontextinfo.h      |  13 +-
 sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h     |  16 ++
 sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h   |  16 ++
 sysdeps/unix/sysv/linux/powerpc/syscall.S          |  14 ++
 sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S   |  64 ++++++
 sysdeps/unix/sysv/linux/pthread_kill.c             |   5 +-
 sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h     |  12 ++
 sysdeps/unix/sysv/linux/s390/sigcontextinfo.h      |  17 ++
 sysdeps/unix/sysv/linux/sh/sigcontextinfo.h        |  11 ++
 sysdeps/unix/sysv/linux/sh/syscall_cancel.S        | 125 ++++++++++++
 sysdeps/unix/sysv/linux/sigwait.c                  |   3 -
 sysdeps/unix/sysv/linux/sigwaitinfo.c              |   3 -
 sysdeps/unix/sysv/linux/socketcall.h               |  37 +++-
 sysdeps/unix/sysv/linux/sparc/lowlevellock.h       |   2 +-
 .../unix/sysv/linux/sparc/sparc32/sigcontextinfo.h |  52 +++++
 .../unix/sysv/linux/sparc/sparc32/syscall_cancel.S |  74 +++++++
 .../libc-cancellation.S => sparc/sparc64/pause.c}  |  14 +-
 .../unix/sysv/linux/sparc/sparc64/sigcontextinfo.h |  40 ++++
 .../unix/sysv/linux/sparc/sparc64/syscall_cancel.S |  74 +++++++
 sysdeps/unix/sysv/linux/syscall_cancel.c           |  64 ++++++
 sysdeps/unix/sysv/linux/sysdep.h                   |  17 ++
 sysdeps/unix/sysv/linux/tile/sigcontextinfo.h      |  12 ++
 sysdeps/unix/sysv/linux/x86_64/cancellation.S      | 115 -----------
 .../unix/sysv/linux/x86_64/librt-cancellation.S    |  21 --
 sysdeps/unix/sysv/linux/x86_64/lowlevellock.h      |   8 +-
 sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h    |  11 ++
 sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h        |  13 ++
 sysdeps/x86_64/nptl/tcb-offsets.sym                |   1 -
 sysdeps/x86_64/nptl/tls.h                          |  11 --
 96 files changed, 2014 insertions(+), 709 deletions(-)
 delete mode 100644 nptl/cancellation.c
 delete mode 100644 nptl/tst-cancel-wrappers.sh
 create mode 100644 nptl/tst-cancel28.c
 rename sysdeps/{nptl/librt-cancellation.c => unix/sysv/linux/hppa/sigcontextinfo.h} (55%)
 create mode 100644 sysdeps/unix/sysv/linux/hppa/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/i386/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/ia64/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/microblaze/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/mips/mips32/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/sh/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
 rename sysdeps/unix/sysv/linux/{x86_64/libc-cancellation.S => sparc/sparc64/pause.c} (66%)
 create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/syscall_cancel.S
 create mode 100644 sysdeps/unix/sysv/linux/syscall_cancel.c
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/cancellation.S
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/librt-cancellation.S

-- 
2.7.4