[PATCH] D35704: added reset feature to dfsan

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 17:04:58 PDT 2017


pcc added inline comments.


================
Comment at: lib/dfsan/dfsan.cc:175
+
+  // reset potentially polluted union table entries
+  for (uptr l = 0; l <= last_label; ++l) {
----------------
Is this part necessary? I believe that the mmap call above will also reset the union table to zero.


================
Comment at: test/dfsan/reset_multithread.cc:20
+    dfsan_reset();
+    pthread_yield();
+    assert(dfsan_get_label_count() == 0);
----------------
Is this really testing for the property that Kostya mentioned? It seems like it is trying to reproduce the scenario where the labels are created in the other thread *after* (i.e. not parallel with) the reset. You might have better luck reproducing if you change the `dfsan_reset` function to do this:
```
void dfsan_reset() {
  atomic store to dfsan_last_label;
  mmap;
  assert(atomic load from dfan_last_label == 0);
}
```


https://reviews.llvm.org/D35704





More information about the llvm-commits mailing list