[Bug 1982326] Re: race between exit() and pthread_exit() with static linking
Michael Hudson-Doyle
1982326 at bugs.launchpad.net
Wed Jul 27 03:42:51 UTC 2022
Have you tried this with glibc from a newer release like 22.04? Or
looked for an upstream bug report on this?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1982326
Title:
race between exit() and pthread_exit() with static linking
Status in glibc package in Ubuntu:
New
Bug description:
When statically linking a C multi-threaded application, there is a race between pthread_exit() and exit() which may cause pthread_exit() to abort the program.
It appears the issue is due to the forced unwind executed by pthread_exit() failing because _Unwind_Find_FDE() returns NULL. Apparently, _Unwind_Find_FDE() returns NULL after __deregister_frame_info_bases() is called as part of the exit handlers invoked by exit().
The issue is easily reproducible (in my machine it occurs approximately in 1 out of 3 runs) when running the attached sample program under strace.
Steps to reproduce:
- build the attached source with `gcc thread_test.c -lpthread -static -o thread_test`
- run with `strace -f ./thread_test`
Example output:
```
<snip>
[pid 28302] +++ killed by SIGABRT (core dumped) +++
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)
```
If the commented code in the sample source is uncommented, we can
confirm that _Unwind_Find_FDE() sometimes returns NULL.
Ubuntu 18.04.6 LTS
Package: libc6 2.27-3ubuntu1.6
Source package: https://launchpad.net/ubuntu/+source/glibc/2.27-3ubuntu1.6
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1982326/+subscriptions
More information about the foundations-bugs
mailing list