[Bug 1982326] Re: race between exit() and pthread_exit() with static linking
lotuspsychje
1982326 at bugs.launchpad.net
Wed Jul 20 09:39:46 UTC 2022
Thank you for taking the time to report this bug and helping to make Ubuntu better. Please execute the following command only once, as it will automatically gather debugging information, in a terminal:
apport-collect 1982326
When reporting bugs in the future please use apport by using 'ubuntu-
bug' and the name of the package affected. You can learn more about this
functionality at https://wiki.ubuntu.com/ReportingBugs.
--
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