[PATCH] D39473: [sanitizers] Add init function to set alignment of low level allocator

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 10:53:52 PST 2017


alekseyshl added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_rtl.cc:411
   SetLowLevelAllocateCallback(OnLowLevelAllocate);
+  SetLowLevelAllocateMinAlignment(SHADOW_GRANULARITY);
 
----------------
Swap the Set.. calls, set the min alignment first.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:210
+  if (low_level_alloc_min_alignment < alignment)
+    low_level_alloc_min_alignment = alignment;
+}
----------------
Did you really mean that alignment can only go up? How about this:

constexpr uptr kLowLevelAllocatorDefaultAlignment = 8;
static uptr low_level_alloc_min_alignment = kLowLevelAllocatorDefaultAlignment;
...
low_level_alloc_min_alignment = Max(alignment, kLowLevelAllocatorDefaultAlignment);


https://reviews.llvm.org/D39473





More information about the llvm-commits mailing list