mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Incorrect thread TID caching
@ 2021-02-03  4:04 Dominic Chen
  2021-02-03  7:16 ` Florian Weimer
  2021-02-03 19:21 ` Rich Felker
  0 siblings, 2 replies; 15+ messages in thread
From: Dominic Chen @ 2021-02-03  4:04 UTC (permalink / raw)
  To: musl

I've been debugging a local port of Chrome using musl, and have noticed 
that musl is caching the thread TID in __pthread_self()->tid, which 
results in incorrect behavior if the application calls the clone() libc 
wrapper or the clone system call, and then calls libc functions which 
use the cached TID value, like raise().

 From a quick skim of other libc implementations, both bionic and glibc 
don't seem to cache TID, and directly call the gettid system call inside 
raise(). I also recall that glibc removed PID caching a few years ago 
due to similar issues there as well. So, it seems that musl should 
either not cache the TID, or at least update the cached value after 
returning from the system call inside the clone() wrapper (with special 
handling for CLONE_VM/CLONE_VFORK)?

Please CC me on replies.

Thanks,

Dominic



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-03-12 21:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03  4:04 [musl] Incorrect thread TID caching Dominic Chen
2021-02-03  7:16 ` Florian Weimer
2021-02-03 19:21 ` Rich Felker
2021-02-03 20:21   ` Dominic Chen
2021-02-03 21:01     ` Rich Felker
2021-02-03 22:30       ` Dominic Chen
2021-02-03 22:55         ` Rich Felker
2021-02-15 16:56           ` Rich Felker
2021-02-17 19:49             ` Dominic Chen
2021-02-17 20:11               ` Rich Felker
2021-02-17 21:07                 ` Rich Felker
2021-03-12 21:14                   ` Dominic Chen
2021-02-04  3:28     ` Carlos O'Donell
2021-02-04  4:22       ` Dominic Chen
2021-02-04 16:15         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).