[asan] Unpoison global metadata on dlclose.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 28 Sep 2017 13:38:58 +0000 (13:38 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 28 Sep 2017 13:38:58 +0000 (13:38 +0000)
dlclose itself might touch it, so better return it to the state it was
before. I don't know how to create a test for this as it would require
chaning dlclose itself.

llvm-svn: 314415

compiler-rt/lib/asan/asan_globals.cc

index ed1e4c6..0db65d0 100644 (file)
@@ -403,6 +403,9 @@ void __asan_unregister_globals(__asan_global *globals, uptr n) {
     }
     UnregisterGlobal(&globals[i]);
   }
+
+  // Unpoison the metadata.
+  PoisonShadow(reinterpret_cast<uptr>(globals), n * sizeof(__asan_global), 0);
 }
 
 // This method runs immediately prior to dynamic initialization in each TU,