http://llvm.org/bugs/show_bug.cgi?id=8441

           Summary: Race condition in AttributesList
           Product: new-bugs
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


This bug seems to be a race condition relating to the static AttributesList in
Attributes.cpp. Access to the AttributesList is locked, but my theory for what
was going on is that at line 125-126, when dropping a reference, we decrement
the count, then check to see if it's zero, then delete "this" (if the refcount
was zero). After we've checked that the count is zero, but before deleting
"this", "this" is still in the AttributesLists set. So in the mean time,
another thread comes along, finds "this" in AttributesList, and references it.
But the first thread has already determined that the count *was* 0, and then
comes back and deletes "this", even though it's now in use by the second
thread.

I've attached a patch which seems to fix this problem for me -- not intended as
a final solution, but it is useful for illustrating the problem.

I'll attach a program which reproduces the problem once I figure out how to
have multiple attachements.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to