[Webkit-unassigned] [Bug 144924] New: Windows: Cannot use HANDLE from GetCurrentThread() to get the CONTEXT of another thread

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 12 12:41:58 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=144924

            Bug ID: 144924
           Summary: Windows: Cannot use HANDLE from GetCurrentThread() to
                    get the CONTEXT of another thread
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mark.lam at apple.com

The present stack scanning code in the Windows port is expecting that the GetCurrentThread() API will provide a unique HANDLE for each thread.  The code then saves and later uses that HANDLE with GetThreadContext() to get the runtime state of the target thread from the GC thread.  According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms683182(v=vs.85).aspx, GetCurrentThread() does not provide this unique HANDLE that we expect:

"The function cannot be used by one thread to create a handle that can be used by other threads to refer to the first thread. The handle is always interpreted as referring to the thread that is using it. A thread can create a "real" handle to itself that can be used by other threads, or inherited by other processes, by specifying the pseudo handle as the source handle in a call to the DuplicateHandle function.”

As a result of this, GetCurrentThread() always returns the same HANDLE value, and we end up never scanning the stacks of other threads because we wrongly think that they are all equal (in identity) to the scanning thread.  This, in turn, results in crashes due objects that are incorrectly collected.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150512/0729e858/attachment-0001.html>


More information about the webkit-unassigned mailing list