[PATCH] D83247: [compiler-rt][asan][hwasan] Refactor shadow setup into sanitizer_common (NFCI)

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 03:07:57 PDT 2020


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_linux.cpp:122
-  uptr granularity = GetMmapGranularity();
-  uptr alignment = granularity * 8;
-  uptr left_padding = granularity;
----------------
kcc wrote:
> tejohnson wrote:
> > The code in asan is multiplying the mmap granularity by 8, whereas the hwasan version shifts it by kShadowScale. I wasn't sure if the 8 here is supposed to be equivalent to a left shift by the shadow scale (which is typically 3 in asan), or is specifically hardcoded separately not using SHADOW_SCALE since it could be something other than 3 in some cases (e.g. 5 for myriad, or user set via ASAN_SHADOW_SCALE). Depending on what was intended here, I would keep the hardcoding of "3" passed to my refactored MapDynamicShadow, or change that to SHADOW_SCALE.
> I frankly don't remember :(
It should be SHADOW_SCALE, myriad works only because it does not use dynamic shadow


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83247





More information about the llvm-commits mailing list