On Thu Aug 3 15:56:21 2023 +0000, Paul Gofman wrote:
We don't. And the thing works for native threads. When it breaks is when there is a Wine thread which has TLS register altered. That is supposed to be restored first with init_handler(). With this patch which tries NtCurrentTeb() before init_handler() segv_handler crashes for Wine thread in pthread_getspecific. And for native thread init_handler can't work.
In other words, we need a neater way to determine if thread is native or Wine, NtCurrentTeb() doesn't fully work for that.