[PATCH] D15048: [tsan] Add dispatch_group API interceptors and synchronization

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 05:37:40 PST 2015


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

LGTM

It seems there is some potential for group API misuse. For example, it is possible to "enter" inside of the async piece of work, instead of before spawning that async piece of work (quite common bug in Go WaitGroup's). Also, since there is ref-counting involved, it can be subject to race use-after-frees (e.g. dispatch_group_notify instead of dispatch_group_async).
Don't know how common are such bugs in real life. But on the other hand we won't know that until we implement detection of these bugs. You can look at https://github.com/golang/go/blob/master/src/sync/waitgroup.go for some ideas (search for "race").


================
Comment at: lib/tsan/rtl/tsan_libdispatch_mac.cc:193
@@ +192,3 @@
+  WRAP(dispatch_async)(queue, ^(void) {
+    block();
+    WRAP(dispatch_group_leave)(group);
----------------
Why don't we need Block_copy here, but need it below? Is the block automatically referenced from captured by another block?


http://reviews.llvm.org/D15048





More information about the llvm-commits mailing list