This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/21793] glibc does not update the pid/tid cache after clone()
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 26 Jul 2017 10:29:19 +0000
- Subject: [Bug libc/21793] glibc does not update the pid/tid cache after clone()
- Auto-submitted: auto-generated
- References: <bug-21793-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21793
--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Carlos O'Donell from comment #2)
> Once you call clone() you own the created thread, and you cannot use any
> POSIX Thread functions provided by the libc you left behind when you cloned
> a new thread manually. If you are using clone() as a convenience function
> for unshare() then you should use unshare().
That is very misleading. If you call clone to create a new *thread*, you
cannot use any glibc function at all, whether POSIX threads or not. *Nothing*
will work on the new thread, not even async-signal-safe functions. A lot of
things worked by accident, most of the time, including malloc, but with the
thread cache in 2.26, malloc will no longer be reliable, for instance.
We still need a correct TID if the clone call created a new process, though.
There is really no way around that. This will be tricky due to vfork.
--
You are receiving this mail because:
You are on the CC list for the bug.