[Lldb-commits] [REVIEW] Data race fix in Address.h

Malea, Daniel daniel.malea at intel.com
Mon Apr 22 14:03:06 PDT 2013


Thanks Greg; committed in 180047.



On 2013-04-22 4:39 PM, "Greg Clayton" <gclayton at apple.com> wrote:

>Looks ok to me. 
>On Apr 22, 2013, at 12:40 PM, "Malea, Daniel" <daniel.malea at intel.com>
>wrote:
>
>> Hi all,
>> 
>> I ran a LLDB through Intel Parallel Inspector XE 2013Š a data race and
>>deadlock detection tool, and it found about 16 problems, most of which
>>are data races. Please review the attached patch that fixes the first
>>race in the Address class. I verified this patch reduces the number of
>>problems Inspector finds to 14, which I plan to investigate before
>>writing some tests that exercise the SB-API from multiple threads.
>> 
>> The problem is that Address is used from multiple threads and m_offset
>>is read and written to without locking, thereby allowing the possibility
>>of partial reads from m_offset. The fix is to wrap m_offset in
>>std::atomic<>.
>> 
>> Phabricator link for easier reviewing:
>>http://llvm-reviews.chandlerc.com/D706
>> 
>> (Patch is also attached)
>> 
>> The details of the race condition are below.
>> 
>> The write happens here from one thread:
>> 
>> liblldb.so!SetRawAddress - Address.h:471
>> liblldb.so!ChangePC - StackFrame.cpp:252
>> liblldb.so!SetPC - RegisterContext.cpp:109
>> liblldb.so!UpdateAfterBreakpoint - RegisterContext_x86_64.cpp:722
>> liblldb.so!BreakNotify - POSIXThread.cpp:247
>> liblldb.so!Notify - POSIXThread.cpp:227
>> liblldb.so!RefreshStateAfterStop - ProcessPOSIX.cpp:419
>> liblldb.so!ShouldBroadcastEvent - Process.cpp:3647
>> liblldb.so!HandlePrivateEvent - Process.cpp:3890
>> liblldb.so!RunPrivateStateThread - Process.cpp:3992
>> liblldb.so!PrivateStateThread - Process.cpp:3929
>> liblldb.so!ThreadCreateTrampoline - Host.cpp:560
>> 
>><address_offset_race_fix.h>______________________________________________
>>_
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>





More information about the lldb-commits mailing list