[PATCH] D61867: [GWP-ASan] Initial build files, implementation of PRNG [1].

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 12:09:40 PDT 2019


morehouse added inline comments.


================
Comment at: compiler-rt/lib/gwp_asan/CMakeLists.txt:10
+set(GWP_ASAN_HEADERS
+  mutex.h
+  random.h
----------------
mutex.h doesn't exist yet.


================
Comment at: compiler-rt/lib/gwp_asan/random.cpp:17
+static thread_local uint64_t RandomStateA =
+    static_cast<uint64_t>(time(nullptr));
+
----------------
We have double-initialization if `getRandomUnsigned64` is called before these initializers run.


================
Comment at: compiler-rt/lib/gwp_asan/random.h:17
+namespace gwp_asan {
+namespace random {
+// TODO(hctim): This may have significant overhead for platforms where
----------------
A random namespace might be overkill.


================
Comment at: compiler-rt/lib/gwp_asan/random.h:20
+// 64-bit arithmetic is emulated. Do we need less than a 2^32 chance of
+// sampling?
+// xorshift128+ (64-bit output). Avoids multiplication.
----------------
1 in 2 billion is very rare.  I don't see a use case for less frequent sampling than that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61867/new/

https://reviews.llvm.org/D61867





More information about the llvm-commits mailing list