[PATCH] D15380: [tsan] Update dispatch_group support to avoid using a disposed group object

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 05:22:49 PST 2015


dvyukov accepted this revision.
dvyukov added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/tsan/rtl/tsan_libdispatch_mac.cc:100
@@ -90,3 +99,3 @@
   user_free(thr, pc, context);
 }
 
----------------
kubabrecka wrote:
> To detect racy-use-after-free, do we need to annotate all uses of the object (a dispatch group in this case) or is it okay to miss some?  Will that produce false positives?  Because here, the group is deallocated either by the explicit dispatch_retain on the main thread, or implicitly when the async block finishes.  I'm not sure how to write a reliable test that would catch the bug here.
It is OK to miss some. As for reliable test, check out e.g. race_on_mutex2.c.
I can't say about implicit/explicit deallocation, you will need to experiment to see how we can detect some misuses without false positives.



http://reviews.llvm.org/D15380





More information about the llvm-commits mailing list