[llvm-commits] [PATCH] [asan] Workaround the self-cleaning TSD on Android

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Jan 19 05:43:17 PST 2012


I think it might not be reliable on all OSs/platforms, but the stack
approach seems to work well for Android and is much simpler than
gettid().

r148475.

On Tue, Jan 17, 2012 at 5:15 AM, Kostya Serebryany <kcc at google.com> wrote:
> btw, I wonder if we can use the value of SP to figure out that we are in the
> main thread. (instead of gettid(), which makes no sense outside of Linux).
>
>
> On Mon, Jan 16, 2012 at 5:13 PM, Kostya Serebryany <kcc at google.com> wrote:
>>
>> I'd prefer to have as few ifdefs as possible, I guess we can have no
>> ifdefs in this patch.
>>
>> Also, you are adding some code to a CTOR which should
>> be LinkerInitialized:
>>
>> @@ -29,7 +29,11 @@
>> AsanThreadRegistry::AsanThreadRegistry(LinkerInitialized x)
>>      : main_thread_(x),
>>        main_thread_summary_(x),
>>        accumulated_stats_(x),
>> -      mu_(x) { }
>> +      mu_(x) {
>> +#ifdef ANDROID
>> +  main_thread_tid_ = AsanGetTid();
>> +#endif
>> +}
>>
>>
>> --kcc
>>
>>
>>
>>
>> On Mon, Jan 16, 2012 at 5:32 AM, Alexander Potapenko <glider at google.com>
>> wrote:
>>>
>>> On Mon, Jan 16, 2012 at 5:24 PM, Evgeniy Stepanov
>>> <eugeni.stepanov at gmail.com> wrote:
>>> > Hi,
>>> >
>>> > this ugly, but efficient patch lets us restore the main thread's
>>> > AsanThread which gets overwritten in the libc constructor.
>>> >
>>> > Please review.
>>>
>>> This looks good to me.
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>




More information about the llvm-commits mailing list