Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <62be4b85-4a42-413e-a83f-866eab4d601a@gmail.com>
Date: Tue, 2 Feb 2021 23:04:23 -0500
From: Dominic Chen <d.c.ddcc@...il.com>
To: musl@...ts.openwall.com
Subject: Incorrect thread TID caching

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


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.