<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 24, 2015 at 5:42 PM, 'Evgenii Stepanov' via thread-sanitizer <span dir="ltr"><<a href="mailto:thread-sanitizer@googlegroups.com" target="_blank">thread-sanitizer@googlegroups.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This means that tcgetattr is not intercepted on Android. Either it was<br>
not there before, or I looked at the wrong place.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Yeah, I guess the intent is that tcgetattr should not be intercepted on android . I don't think it was enough though, even if it worked as intended -- At least on a fairly recent build for android, the chain isatty() -> tcgettatr() (and then finally ioctl()) were being caught be TSAN recursively, and were problematic. It seems simpler to not have those calls caught by TSAN when theya are being made by bionic...<br><br></div><div>Thanks for the clarification, Evgenii.<br></div><div>-Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<br>
On Thu, Sep 24, 2015 at 5:39 PM, enh <<a href="mailto:enh@google.com">enh@google.com</a>> wrote:<br>
> On Thu, Sep 24, 2015 at 11:18 AM, Jason Kim <<a href="mailto:jasonk@codeaurora.org">jasonk@codeaurora.org</a>> wrote:<br>
>> Hi everyone.<br>
>><br>
>> Thanks to everyone for taking the time to meet yesterday. I think it was<br>
>> very productive!<br>
>><br>
>> I am writing to keep a "minutes" of the meet, as I remember them.<br>
>><br>
>> Action Items:<br>
>><br>
>> Jasonk: split up bionic patch to explicitly replace CPP macros with actual<br>
>> calls, one file at a time.<br>
>> Google/Android: pthread_barrier interface in bionic<br>
>> Enh: 1 paragraph to explain "namespacing" in bionic?? (in case we need to<br>
>> reconsider macro replacement again?)<br>
><br>
> grep for "namespace.h" and "un-namespace.h". interestingly, freebsd<br>
> and netbsd have this but openbsd doesn't.<br>
><br>
>> Some technical notes/explanations that possibly weren't made clear at the<br>
>> meeting.<br>
>><br>
>> The current compller-rt patch (on phabricator) is already a pretty minimal<br>
>> set. The only real bit of actual functionality (other than the<br>
>> infrastructure bits to enable TSAN on android/aarch64) is the TLS<br>
>> workaround.<br>
>><br>
>> i.e. the major pieces for my patch to compiler-rt are:<br>
>><br>
>> infrastructure (new definitions, cmake changes etc..)<br>
>> TLS workaround<br>
>> pthread_barrier-like interface for tests<br>
>> disabling of some tests on android-aarch64<br>
>><br>
>> My current hypothesis is that the 120 tests (out of 200 or so) that are<br>
>> failing are due the behavioral mismatch of my "quick hack" to enable<br>
>> barrier-like behavior on android. Assuming that Google's implementation of<br>
>> the barrier interface on android/aarch64 is a better fit with linux-x86_64,<br>
>> this will hopefully result in more tests passing.<br>
>><br>
>> Very important info regarding why __bionic_XXX() replacement for calls to<br>
>> XXX() will most likely need to be "global" (within bionic) in most cases:<br>
>><br>
>> deadlocks, crashes in TSAN were all due to unexpected interceptions WHILE a<br>
>> call was already being intercepted by TSAN.<br>
>> The most obvious TSAN-only workaround is to ignore interceptions when this<br>
>> is taking place. This works for two threads, but does not scale to more<br>
>> threads without the danger of TSAN missing events.<br>
>> Any unexpected nested call chains in bionic that TSAN currently intercepts<br>
>> will either need custom coding in TSAN to explicitly handle (for all<br>
>> possible cases in which such call chains can occur), OR replace those calls<br>
>> in bionic with non-interceptible ones. The former will obviously add much<br>
>> more complexity to TSAN (to wit, additional testing failure vulnerability),<br>
>> while the latter will mean more (mechanical) changes to BIONIC. Currently,<br>
>> my thinking is that the latter, (being mechanical in nature) is preferable.<br>
>> To ENH: The same holds for calls to tcgetattr() --> ioctl(), and isatty() -><br>
>> tcgetattr() --> ioctl() call chains. TSAN intercepts tcgetattr() and<br>
>> ioctl(), and is not expecting recursive interceptions during them.<br>
><br>
> what does this mean?<br>
><br>
> external/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h:144:#define<br>
> SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID<br>
><br>
>> Its not<br>
>> at all clear how to handle this within TSAN, especially among multiple<br>
>> threads. Even if a logic can be worked out, it's fundamentally much clearer<br>
>> to simply disallow such interceptions to occur.<br>
>><br>
>> Things that might require future discussion:<br>
>><br>
>> need a build-bot/test bot on <a href="http://labs.llvm.org" rel="noreferrer" target="_blank">labs.llvm.org</a> for android-bionic-aarch64-tsan<br>
>> tests to prevent insanity inducing regressions :-)<br>
>><br>
>> Thanks for reading!<br>
>><br>
>> -Jason<br>
>><br>
>><br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> Elliott Hughes - <a href="http://who/enh" rel="noreferrer" target="_blank">http://who/enh</a> - <a href="http://jessies.org/~enh/" rel="noreferrer" target="_blank">http://jessies.org/~enh/</a><br>
> Android native code/tools questions? Mail me/drop by/add me as a reviewer.<br>
<br>
--<br>
You received this message because you are subscribed to the Google Groups "thread-sanitizer" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:thread-sanitizer%2Bunsubscribe@googlegroups.com">thread-sanitizer+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
</div></div></blockquote></div><br></div></div>