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

Kostya Serebryany kcc at google.com
Mon Sep 23 22:15:19 PDT 2013


Good question.
The code size change is very small and to my surprise is negative (i.e.
with the new flag the binaries are a bit smaller)
  benchmark        before   after
  400.perlbench   9552   9440   -1
      401.bzip2   3260   3252   0
        403.gcc  20108  20000   0
        429.mcf   2864   2864   0
      445.gobmk  13764  13748   0
      456.hmmer   4496   4492   0
      458.sjeng   3412   3408   0
 462.libquantum   2960   2960   0
    464.h264ref   5696   5688   0
    471.omnetpp   6232   6212   0
      473.astar   3128   3128   0
  483.xalancbmk  49564  49304   0
       433.milc   3476   3472   0
       444.namd   4596   4608   0
     447.dealII  43996  43660   0
     450.soplex   7548   7436   -1
     453.povray   9160   9048   -1
        470.lbm   2836   2840   0
    482.sphinx3   3848   3844   0

I still need to make measurements at -O1, where the slowdown might be worse
than at -O2.




On Mon, Sep 23, 2013 at 9:33 PM, Reid Kleckner <rnk at google.com> wrote:

> 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/20130924/9b42c9a1/attachment.html>


More information about the llvm-commits mailing list