[Webkit-unassigned] [Bug 129173] New: getPlatformThreadRegisters() returns the wrong size on the pthread port

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 21 15:06:47 PST 2014


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

           Summary: getPlatformThreadRegisters() returns the wrong size on
                    the pthread port
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: mark.lam at apple.com
                CC: mark.lam at apple.com


In heap/MachineStackMarker.cpp, getPlatformThreadRegisters() is supposed to return the size of PlatformThreadRegisters.  This is because MachineThreads::gatherFromOtherThread() expects to scan the thread registers by scanning from &regs to &regs + regSize where regSize is the value returned by getPlatformThreadRegisters().  Currently, the pthread port's getPlatformThreadRegisters() returns 0.  That means the pthread port is not scanning the thread registers and may result in GC not retaining some live objects.

One possible fix is to have getPlatformThreadRegisters() return sizeof(regs).  This will only work if pthread_attr_t (which is how the pthread port implements PlatformThreadRegisters) is a struct that will hold the register values that the GC needs to scan.

However, the spec says "The pthread_attr_t type should be treated as opaque: any access to the object other than via pthreads functions is nonportable and produces undefined results."  If pthread_attr_t is implemented as a handle / pointer to some buffer that contains the register values, then there's a bigger problem i.e. MachineThreads::gatherFromOtherThread() 's scan will be ineffective based on the current pthread implementation of PlatformThreadRegisters.  The proper fix will require copying the thread register values to a port defined PlatformThreadRegisters struct that MachineThreads::gatherFromOtherThread() can scan instead of assuming that pthread_attr_t is that struct.

This bug will affect any ports that uses pthread i.e. gtk, elf, but only if they invoke JSC from more than one thread (after acquiring the VM JSLock, of course).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list