Comment 2 for bug 1915682

Revision history for this message
Dirk A Niggemann (dniggema) wrote :

That was a complete misdiaagnsis. The IRET works fine in user space, at the lowest privlege level.

The wrong thread is not restarted. The correct thread continues execution, at the correct address, but with the wrong thread-local data.

Thread-local data is accessed via the segment loaded in the fs register in wine. The segment selector is set the same in each thread, but each thread should have a unique GDT entry pointing to its thread-local data.

The issue is that clone() copies the pointer reference to the process's GDT without creating a new GDT area. All threads wind up sharing the same GDT. As the selector is the same, all threads share the same threa-local data. Oddly enough, this has fewer ill effects than excpected. Unless SEH (Structured Exception Handling) is invoked, at which point threads start unwinding the stack frames of other threads...

Copying the GDT during clone() results in a workig system with correct exception handling.