[PATCH] Enable -fsanitize=use-after-return by default under -fsanitize=address

Reid Kleckner rnk at google.com
Mon Sep 23 10:33:31 PDT 2013


Do you have code size increase numbers as well?


On Mon, Sep 23, 2013 at 2:11 AM, Kostya Serebryany <kcc at google.com> wrote:

> Hi samsonov,
>
> We enable ASAN's use-after-return instrumentation at compile-time,
> but still keep it disabled at run-time.
> This enables the users to flip the flag at run-time using environment
> variable
> ASAN_OPTIONS=detect_stack_use_after_return=1 instead of using a separate
> build.
> If UAR detection is disabled at run-time, this extra compile-time
> instrumentation
> costs very small slowdown. On SPEC 2006 14 tests are not affected at all,
> 4 tests get ~ 1% slowdown and 453.povray gets 4%.
>
> http://llvm-reviews.chandlerc.com/D1741
>
> Files:
>   lib/Driver/SanitizerArgs.cpp
>
> Index: lib/Driver/SanitizerArgs.cpp
> ===================================================================
> --- lib/Driver/SanitizerArgs.cpp
> +++ lib/Driver/SanitizerArgs.cpp
> @@ -211,11 +211,11 @@
>  #define SANITIZER_GROUP(NAME, ID, ALIAS) .Case(NAME, ID)
>  #include "clang/Basic/Sanitizers.def"
>      .Default(SanitizeKind());
> -  // Assume -fsanitize=address implies -fsanitize=init-order.
> +  // Assume -fsanitize=address implies
> -fsanitize=init-order,use-after-return.
>    // FIXME: This should be either specified in Sanitizers.def, or go away
> when
> -  // we get rid of "-fsanitize=init-order" flag at all.
> +  // we get rid of "-fsanitize=init-order,use-after-return" flags at all.
>    if (ParsedKind & Address)
> -    ParsedKind |= InitOrder;
> +    ParsedKind |= InitOrder | UseAfterReturn;
>    return ParsedKind;
>  }
>
> _______________________________________________
> 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/20130923/e64a5b97/attachment.html>


More information about the llvm-commits mailing list