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

Kostya Serebryany kcc at google.com
Mon Jan 16 17:15:02 PST 2012


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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120116/e7f8fa68/attachment.html>


More information about the llvm-commits mailing list