[PATCH] D41616: [hwasan] Add heap tag randomization.

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 31 13:11:45 PST 2017


alekseyshl accepted this revision.
alekseyshl added inline comments.
This revision is now accepted and ready to land.


================
Comment at: compiler-rt/lib/hwasan/hwasan_thread.cc:100
+      random_buffer_ = random_state_ = xorshift(random_state_);
+    CHECK(random_buffer_);
+    tag = random_buffer_ & 0xFF;
----------------
GetRandom and xorshift can result in 0, right? Maybe this and drop CHECK:

  if (!random_buffer_) {
    random_state_ = xorshift(random_state_);
    while (!random_state)
      random_state = RandomSeed();
    random_buffer_ = random_state_;
  }


https://reviews.llvm.org/D41616





More information about the llvm-commits mailing list