Thread Sanitizer on Android

680 views
Skip to first unread message

Jay Yadav

unread,
Mar 20, 2017, 5:27:54 AM3/20/17
to thread-s...@googlegroups.com
Hi Thread Sanitizer Team,

I am trying to enable thread sanitizer on Android. I followed the procedure mentioned on below link https://github.com/google/sanitizers/wiki/ThreadSanitizerOnAndroid.

Can you please elaborate step 5 of above link.

After linking the surface flinger process with libtsan_shared.so. and then I pushed the surfaceflinger and libtsan_shared.so in system/bin and system/lib64/ respectively.
Surface flinger process is getting killed by crashed.
--------- beginning of crash
01-01 17:44:56.912   775   775 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7fdb9eeff0 in tid 775 (surfaceflinger)


It will be great if you can point out the mistake I am doing.


Thanks,
Jay Yadav

Dmitry Vyukov

unread,
Mar 20, 2017, 5:30:16 AM3/20/17
to thread-s...@googlegroups.com, Евгений Степанов
+Evgenii, do you know who wrote that page? The history says that it
was me, but I have no memory of this place.

Evgenii Stepanov

unread,
Mar 20, 2017, 1:04:26 PM3/20/17
to thread-s...@googlegroups.com, Yabin Cui
+Yabin
> --
> You received this message because you are subscribed to the Google Groups "thread-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to thread-sanitiz...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Yabin Cui

unread,
Mar 22, 2017, 10:02:11 PM3/22/17
to Evgenii Stepanov, thread-sanitizer
I tried on building thread sanitizer on android aosp master. It's compiler-rt code was updated on 2016/9,  so I don't need to replace it with upstream code.
I found a problem when building it, it is __pointer_chk_guard. we don't have __point_chk_guard symbol on android. (I don't know why I built successfully before.) The latest patch in upstream seems has fixed this. But I haven't verified it yet. 

So I exclude tsan_rtl_aarch64.S from libtsan.so and disables 
  TSAN_INTERCEPT(longjmp);
  TSAN_INTERCEPT(siglongjmp);in tsan_rtl_interceptors.cc.
Then I can build libtsan.so and link it with executables on device. I haven't tried linking it with surfaceflinger yet,but will try it later.

> To unsubscribe from this group and stop receiving emails from it, send an email to thread-sanitizer+unsubscribe@googlegroups.com.

bung...@chromium.org

unread,
Mar 23, 2017, 3:14:56 PM3/23/17
to thread-sanitizer, eug...@google.com
Is http://llvm.org/viewvc/llvm-project?view=revision&revision=278292 relevant to the __point_chk_guard issue? My compiler-rt doesn't seem to have this change, not sure how this updates in Android. (See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71042 ).
> To unsubscribe from this group and stop receiving emails from it, send an email to thread-sanitiz...@googlegroups.com.

bung...@google.com

unread,
Mar 24, 2017, 9:51:00 AM3/24/17
to thread-sanitizer, eug...@google.com
Just wanted to update this to say that applying the patch from http://llvm.org/viewvc/llvm-project?view=revision&revision=278292 seems to work around the __point_chk_guard issue and allows the libtsan_sanitizer.so to build. I haven't actually been able to use it on anything yet, but it does build. It is unfortunate that it appears this revision happened the day (literally hours) after the last time compiler-rt was merged. On the other hand it means the patch currently applies quite cleanly.
Reply all
Reply to author
Forward
0 new messages