[llvm] r174964 - [ASan] Do not use kDefaultShort64bitShadowOffset on Mac, where the binaries may get mapped at 0x100000000+ and thus may interleave with the shadow.

Kostya Serebryany kcc at google.com
Tue Feb 12 21:15:06 PST 2013


On Wed, Feb 13, 2013 at 1:20 AM, Bill Wendling <bwendling at apple.com> wrote:

> On Feb 12, 2013, at 4:41 AM, Alexander Potapenko <glider at google.com>
> wrote:
>
> > Author: glider
> > Date: Tue Feb 12 06:41:12 2013
> > New Revision: 174964
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=174964&view=rev
> > Log:
> > [ASan] Do not use kDefaultShort64bitShadowOffset on Mac, where the
> binaries may get mapped at 0x100000000+ and thus may interleave with the
> shadow.
> >
> > Modified:
> >    llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=174964&r1=174963&r2=174964&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
> (original)
> > +++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue
> Feb 12 06:41:12 2013
> > @@ -202,6 +202,7 @@ static ShadowMapping getShadowMapping(co
> >                                       bool ZeroBaseShadow) {
> >   llvm::Triple TargetTriple(M.getTargetTriple());
> >   bool IsAndroid = TargetTriple.getEnvironment() ==
> llvm::Triple::Android;
> > +  bool IsMacOSX = TargetTriple.getOS() == llvm::Triple::MacOSX;
> >   bool IsPPC64 = TargetTriple.getArch() == llvm::Triple::ppc64;
> >   bool IsX86_64 = TargetTriple.getArch() == llvm::Triple::x86_64;
> >
> > @@ -215,7 +216,7 @@ static ShadowMapping getShadowMapping(co
> >   Mapping.Offset = (IsAndroid || ZeroBaseShadow) ? 0 :
> >       (LongSize == 32 ? kDefaultShadowOffset32 :
> >        IsPPC64 ? kPPC64_ShadowOffset64 : kDefaultShadowOffset64);
> > -  if (!ZeroBaseShadow && ClShort64BitOffset && IsX86_64) {
> > +  if (!ZeroBaseShadow && ClShort64BitOffset && IsX86_64 && !IsMacOSX) {
> >     assert(LongSize == 64);
> >     Mapping.Offset = kDefaultShort64bitShadowOffset;
> >   } if (!ZeroBaseShadow && ClMappingOffsetLog >= 0) {
> >
> This 'if' here is on the same line as the previous '}'. Is that intended?
> or is there a missing 'else' here?
>

The code is correct, but the indentation is confusing.
Fixed in r175033. Thanks!

--kcc



>
> -bw
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130213/baf63463/attachment.html>


More information about the llvm-commits mailing list