[scudo] use 32 bits of ASLR entropy instead of just 24 when shuffling allocated chunks
authorKostya Serebryany <kcc@google.com>
Mon, 29 Aug 2016 17:45:43 +0000 (17:45 +0000)
committerKostya Serebryany <kcc@google.com>
Mon, 29 Aug 2016 17:45:43 +0000 (17:45 +0000)
llvm-svn: 279983

compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h

index deaa03e..d6fdcd7 100644 (file)
@@ -403,7 +403,7 @@ class SizeClassAllocator64 {
     uptr region_beg = GetRegionBeginBySizeClass(class_id);
     if (end_idx + size > region->mapped_user) {
       if (!kUsingConstantSpaceBeg && region->mapped_user == 0)
-        region->rand_state = region_beg;  // Comes from ASLR.
+        region->rand_state = static_cast<u32>(region_beg >> 12);  // From ASLR.
       // Do the mmap for the user memory.
       uptr map_size = kUserMapSize;
       while (end_idx + size > region->mapped_user + map_size)