On Wednesday, April 17, 2024 3:02:13 PM CDT Elizabeth Figura wrote: > > > Except for the "unowned" semantics of zero, the actual value of the > > > owner identifier is not interpreted by the ntsync driver at all. The > > > intended use is to store a thread identifier; however, the ntsync > > > driver does not actually validate that a calling thread provides > > > consistent or unique identifiers. > > > > Why not verify it? Seems simple enough to put in a TID check, esp. if NT > > mandates the same. > > I mostly figured it'd be simplest to leave the driver completely > agnostic, but I don't think there's any reason we can't use the real > TID for most calls. While trying to implement this I did realize a reason: if a Linux thread dies and a new Wine thread is created which happens to have the same Linux TID *before* Wine notices the thread death, that thread's TID will be conflated with the thread that died. I don't think we can guarantee that we notice thread death before we notice a request to create a new Wine thread. Using Wine-managed TIDs avoids this by virtue of ensuring that a Wine TID is not reused until the associated Wine thread has been cleaned up.