[compiler-rt] r224508 - tsan: don't crash with NULL deref during reporting

David Blaikie dblaikie at gmail.com
Sun Dec 21 18:28:34 PST 2014


On Thu, Dec 18, 2014 at 2:19 AM, Dmitry Vyukov <dvyukov at google.com> wrote:

> Author: dvyukov
> Date: Thu Dec 18 04:19:32 2014
> New Revision: 224508
>
> URL: http://llvm.org/viewvc/llvm-project?rev=224508&view=rev
> Log:
> tsan: don't crash with NULL deref during reporting
>
> tctx==NULL crash observed during deadlock reporting.
> There seems to be some bugs in the deadlock detector,
> but it is still useful to be more robust during reporting.
>

So you don't know why tctx is null in this case - isn't this a bit of a
hack/workaround, rather than an actual fix, then? It's sort of unfortunate
to build up cruft to tolerate violations of invariants we believe should
hold...


>
>
> Modified:
>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=224508&r1=224507&r2=224508&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Thu Dec 18 04:19:32
> 2014
> @@ -251,7 +251,9 @@ ThreadContext *IsThreadStackOrTls(uptr a
>
>  void ScopedReport::AddThread(int unique_tid, bool suppressable) {
>  #ifndef SANITIZER_GO
> -  AddThread(FindThreadByUidLocked(unique_tid), suppressable);
> +  const ThreadContext *tctx = FindThreadByUidLocked(unique_tid);
> +  if (tctx)
>

Usually we roll the variable declaration into the condition in cases like
this.


> +    AddThread(FindThreadByUidLocked(unique_tid), suppressable);
>  #endif
>  }
>
>
>
> _______________________________________________
> 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/20141221/784700f5/attachment.html>


More information about the llvm-commits mailing list