[PATCH v5 0/3] NPTL synchronization fixes

Florian Weimer fweimer@redhat.com
Fri Nov 28 17:22:27 GMT 2025


* Adhemerval Zanella:

> It seems that this issues has triggered another problem [1], and the
> BZ 19951 [2] report has other two different reports where pthread_detach
> is triggering an synchronization issue.
>
> Changes from v4 [3]:
> * Rebased against master.
> * Reword some comments.
>
> [1] https://sourceware.org/pipermail/libc-alpha/2025-November/172867.html
> [2] https://sourceware.org/bugzilla/show_bug.cgi?id=19951
> [3] https://patchwork.sourceware.org/project/glibc/list/?series=50344
>
> Adhemerval Zanella (3):
>   nptl: Set cancellation type and state on pthread_exit (BZ #28267)
>   nptl: Do not use pthread set_tid_address as state synchronization (BZ
>     #19951)
>   nptl: Remove INVALID_TD_P

I reviewed this.  Mostly nits.  Overall direction looks sound.

Summary of my findings:

* Perhaps missing credits for musl?

* There are a couple of cases where call cancellable join from a
  location that can't be a cancellation point (due to _THROW etc.).
  Most of them are pre-existing and could perhaps be cleaned up
  separately.

* Lots of acquire MO loads for joinstate.  It's unclear to me what they
  synchronize with.  I suspect we should switch to synchronization on
  result instead.

* Deadlock check in pthread_join looks wrong.

* Main thread switches to THREAD_STATE_EXITED without blocking signals
  first.

I ran my sped-up version of Google's test against your patches for a
couple of machine-days (on large x86-64 and aarch64 machines), and no
failures showed up.  Previously I saw a couple of failures per day per
machine.

Thanks,
Florian



More information about the Libc-alpha mailing list