Helgrind warning about race in GetThreadLog()



5 years ago
6 months ago


(Reporter: Ben Turner (not reading bugmail, use the needinfo flag!), Assigned: Ben Turner (not reading bugmail, use the needinfo flag!))


Firefox Tracking Flags

(Not tracked)



(1 attachment)

Created attachment 721460 [details] [diff] [review]
Patch, v1

Bug 806618 added GetThreadLog() which races reliably:

==8453== Possible data race during read of size 8 at 0x812C770 by thread #1
==8453== Locks held: none
==8453==    at 0x660E495: GetThreadLog() (nsThread.cpp:48)
==8453==    by 0x660F72C: nsThread::Dispatch(nsIRunnable*, unsigned int) (nsThread.cpp:388)
==8453==    by 0x65CA3BC: NS_NewThread_P(nsIThread**, nsIRunnable*, unsigned int) (nsThreadUtils.cpp:79)
==8453==    by 0x6621F08: nsCycleCollector_startup() (nsCycleCollector.cpp:2833)
==8453==    by 0x65D04EB: NS_InitXPCOM2_P (nsXPComInit.cpp:443)
==8453==    by 0x4084BE: main (xpcshell.cpp:1798)
==8453== This conflicts with a previous write of size 8 by thread #3
==8453== Locks held: none
==8453==    at 0x660E4AF: GetThreadLog() (nsThread.cpp:49)
==8453==    by 0x660F08E: nsThread::ProcessNextEvent(bool, bool*) (nsThread.cpp:572)
==8453==    by 0x65CA004: NS_ProcessNextEvent_P(nsIThread*, bool) (nsThreadUtils.cpp:238)
==8453==    by 0x660EEF3: nsThread::ThreadFunc(void*) (nsThread.cpp:265)
==8453==    by 0x408D323: _pt_root (ptthread.c:192)
==8453==    by 0x403032F: mythread_wrapper (hg_intercepts.c:219)
==8453==    by 0x4A2CE99: start_thread (pthread_create.c:308)
==8453==    by 0x8992CBC: clone (clone.S:112)

Patch attached fixes the race.
Attachment #721460 - Flags: review?(benjamin)
Assignee: nobody → bent.mozilla


5 years ago
Attachment #721460 - Flags: review?(benjamin) → review+
You need to log in before you can comment on or make changes to this bug.