[PATCH] D20084: [sanitizer] Initial implementation of a Hardened Allocator

Alexander Potapenko via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 08:23:50 PDT 2016


glider added inline comments.

================
Comment at: projects/compiler-rt/lib/hardened_allocator/scudo_utils.cc:109
@@ +108,3 @@
+    std::hash<std::thread::id> hasher;
+    return RdTSC() ^ hasher(std::this_thread::get_id()) ^
+        std::chrono::high_resolution_clock::now().time_since_epoch().count();
----------------
glider wrote:
> My gut feeling is that XORing rdtsc and the time since epoch is actually reducing the entropy, not increasing it. Any idea if that's true?
> Also, do we really need a dependency on std::chrono?
As a data point, I've ran RdTSC() and std::chrono::high_resolution_clock::now().time_since_epoch().count() 200278017 times.
The number of unique values of both variables was exactly 200278017, while the number of unique XOR values was only 200205416, i.e. there were 0.036% collisions.


http://reviews.llvm.org/D20084





More information about the llvm-commits mailing list