[PATCH] D23354: [asan] Support dynamic shadow address instrumentation

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 09:45:10 PDT 2016


etienneb added a comment.

Thanks Anna. I modified this patch to include your changes.

If you have some cycles, can you run the unittests with both patches on iOS.
I can't test on that platform.

- https://reviews.llvm.org/D23354
- https://reviews.llvm.org/D25104

Tests are fine on windows 32/64 and linux 64.

In https://reviews.llvm.org/D23354#557270, @zaks.anna wrote:

> When testing with this patch on the Mac, I ran into a problem using -asan-force-dynamic-shadow. Specifically, Mapping.OrShadowOffset was not inferred correctly because it relies on checking kDynamicShadowSentinel and not the ClForceDynamicShadow. How about using ClForceDynamicShadow when setting the Mapping.Offset and gating the maybeInsertDynamicShadowAtFunctionEntry solely on the value of the Mapping.Offset?
>
>   @@ -434,13 +434,19 @@ static ShadowMapping getShadowMapping(Triple &TargetTriple, int LongSize,
>   ...
>        else
>          Mapping.Offset = kDefaultShadowOffset64;
>      }
>   
>   +  if (ClForceDynamicShadow) {
>   +    Mapping.Offset = kDynamicShadowSentinel;
>   +  }
>   +
>      Mapping.Scale = kDefaultShadowScale;
>      if (ClMappingScale.getNumOccurrences() > 0) {
>        Mapping.Scale = ClMappingScale;
>   @@ -1802,7 +1808,7 @@ bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) {
>   
>    void AddressSanitizer::maybeInsertDynamicShadowAtFunctionEntry(Function &F) {
>      // Generate code only when dynamic addressing is needed.
>   -  if (!ClForceDynamicShadow && Mapping.Offset != kDynamicShadowSentinel)
>   +  if (Mapping.Offset != kDynamicShadowSentinel)
>        return;
>   
>      IRBuilder<> IRB(&F.front().front());
>  
>
>
> If you'd like, I can commit this as a separate patch.





https://reviews.llvm.org/D23354





More information about the llvm-commits mailing list