[PATCH] D39471: [asan] Fix small X86_64 ShadowOffset for non-default shadow scale

Walter Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 07:34:23 PST 2017


waltl marked 3 inline comments as done.
waltl added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:524
       else
-        Mapping.Offset = kSmallX86_64ShadowOffset;
+        Mapping.Offset = 0x7FFFFFFF & (0xFFFFF000 << Mapping.Scale);
     } else if (IsWindows && IsX86_64) {
----------------
vitalybuka wrote:
> kcc wrote:
> > vitalybuka wrote:
> > > UB of shifting into sign bit?
> > > 0xFFFFF000ULL?
> > > Same above.
> > Please don't use constants in the code. 
> kSmallX86_64ShadowOffset << (Mapping.Scale - kDefaultShadowScale) ?
> 
This isn't quite right: we'd still need a mask, and the shift value in theory may be negative.  Please take a look at the updated code.



https://reviews.llvm.org/D39471





More information about the llvm-commits mailing list