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

Alexander Potapenko via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 10:00:43 PDT 2016


glider added inline comments.

================
Comment at: lib/hardened_allocator/scudo_allocator.cc:331
@@ +330,3 @@
+    header.requested_size = size;
+    header.salt = static_cast<u16>(prng.Next());
+    chunk->StoreHeader(&header, nullptr);
----------------
Is the salt value used anywhere? If not, what's its point?

================
Comment at: lib/hardened_allocator/scudo_utils.h:39
@@ +38,3 @@
+
+// Tiny PRNG based on https://en.wikipedia.org/wiki/Xorshift#xorshift.2B
+// The state (128 bits) will be stored in thread local storage
----------------
Note that Xorshift isn't cryptographically secure, and may be easy to predict.


http://reviews.llvm.org/D20084





More information about the llvm-commits mailing list