[PATCH] D33325: [sanitizer] Avoid possible deadlock in child process after fork

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 14:44:10 PDT 2017


eugenis added inline comments.


================
Comment at: lib/msan/msan_interceptors.cc:1231
 static void BeforeFork() {
+  get_allocator().ForceLock();
   StackDepotLockAll();
----------------
just a nit: ASan takes these locks in a different order, please be consistent.


================
Comment at: test/sanitizer_common/TestCases/Linux/allocator_fork_no_hang.cc:32
+  while (true) {
+    void *p = malloc(1337);
+    free(p);
----------------
A volatile or -O0 flag would not hurt to make sure this is not optimized out.
I'm not sure how this can cause cache refill without quarantine.  I think it would just keep reallocating the same chunk. Could it be the reason the problem does not reproduce on TSan?



================
Comment at: test/sanitizer_common/TestCases/Linux/allocator_fork_no_hang.cc:41
+// Run through malloc/free in the child process.
+// If any of the hash table cells are locked, this may deadlock.
+// This can also deadlock at allocator cache refilling.
----------------
What are these hash table cells?


Repository:
  rL LLVM

https://reviews.llvm.org/D33325





More information about the llvm-commits mailing list