diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-05-21 14:19:23 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-06-09 15:16:45 -0300 |
commit | 02189e8fb00c3c7f4e67476e21011a22c5dee707 (patch) | |
tree | 3baa2efe20a4e2eba0b4bd303040936e8e5b5525 /abi-tags | |
parent | 699361795f6af887f26585962b8a73a394aab653 (diff) | |
download | glibc-02189e8fb00c3c7f4e67476e21011a22c5dee707.tar glibc-02189e8fb00c3c7f4e67476e21011a22c5dee707.tar.gz glibc-02189e8fb00c3c7f4e67476e21011a22c5dee707.tar.bz2 glibc-02189e8fb00c3c7f4e67476e21011a22c5dee707.zip |
nptl: Deallocate the thread stack on setup failure (BZ #19511)
To setup either the thread scheduling parameters or affinity,
pthread_create enforce synchronization on created thread to wait until
its parent either release PD ownership or send a cancellation signal if
a failure occurs.
However, cancelling the thread does not deallocate the newly created
stack since cancellation expects that a pthread_join to deallocate any
allocated thread resouces (threads stack or TLS).
This patch changes on how the thread resource is deallocate in case of
failure to be synchronous, where the creating thread will signal the
created thread to exit early so it could be joined. The creating thread
will be reponsible for the resource cleanup before returning to the
caller.
To signal the creating thread that a failure has occured, an unused
'struct pthread' member, parent_cancelhandling_unsed, now indicates
whether the setup has failed so creating thread can proper exit.
This strategy also simplifies by not using thread cancellation and
thus not running libgcc_so load in the signal handler (which is
avoided in thread cancellation since 'pthread_cancel' is the one
responsible to dlopen libgcc_s). Another advantage is since the
early exit is move to first step at thread creation, the signal
mask is not already set and thus it can not act on change ID setxid
handler.
Checked on x86_64-linux-gnu and aarch64-linux-gnu.
Diffstat (limited to 'abi-tags')
0 files changed, 0 insertions, 0 deletions