[PATCH] D31479: [asan] Turn -fsanitize-address-use-after-scope on by default

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 15:07:56 PDT 2017


kubamracek created this revision.
kubamracek added a project: Sanitizers.

AddressSanitizer has an optional compile-time flag, `-fsanitize-address-use-after-scope`, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using `-DLLVM_USE_SANITIZER=Address`), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set `true` as the default value for `AsanUseAfterScope`.  This also causes the lifetime markers to be generated whenever `fsanitize=address` is used.  This has some nice consequences, e.g. we now have line numbers for all local variables.  Several testcases needed to be updated to address this change.  The `ParseFrameDescription` function needed to be updated to properly parse "varname:line".


Repository:
  rL LLVM

https://reviews.llvm.org/D31479

Files:
  projects/compiler-rt/lib/asan/asan_descriptions.cc
  projects/compiler-rt/lib/asan/asan_report.cc
  projects/compiler-rt/lib/asan/asan_report.h
  projects/compiler-rt/test/asan/TestCases/Linux/memmem_test.cc
  projects/compiler-rt/test/asan/TestCases/Posix/stack-use-after-return.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_intercept_memchr.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_intercept_memcpy.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_intercept_memcpy_indirect.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_intercept_memset.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_noreturn.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_poison_unpoison.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_stack_use_after_return.cc
  projects/compiler-rt/test/asan/TestCases/Windows/dll_thread_stack_array_left_oob.cc
  projects/compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cc
  projects/compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cc
  projects/compiler-rt/test/asan/TestCases/Windows/stack_array_left_oob.cc
  projects/compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cc
  projects/compiler-rt/test/asan/TestCases/Windows/stack_use_after_return.cc
  projects/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_stack.cc
  projects/compiler-rt/test/asan/TestCases/stack-buffer-overflow-with-position.cc
  projects/compiler-rt/test/asan/TestCases/strcasestr-1.c
  projects/compiler-rt/test/asan/TestCases/strcasestr-2.c
  projects/compiler-rt/test/asan/TestCases/strcspn-1.c
  projects/compiler-rt/test/asan/TestCases/strcspn-2.c
  projects/compiler-rt/test/asan/TestCases/strpbrk-1.c
  projects/compiler-rt/test/asan/TestCases/strpbrk-2.c
  projects/compiler-rt/test/asan/TestCases/strspn-1.c
  projects/compiler-rt/test/asan/TestCases/strspn-2.c
  projects/compiler-rt/test/asan/TestCases/strstr-1.c
  projects/compiler-rt/test/asan/TestCases/strstr-2.c
  projects/compiler-rt/test/asan/TestCases/strtok.c
  projects/compiler-rt/test/asan/TestCases/use-after-scope-inlined.cc
  projects/compiler-rt/test/asan/TestCases/use-after-scope.cc
  tools/clang/include/clang/Driver/SanitizerArgs.h
  tools/clang/test/Driver/fsanitize.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31479.93415.patch
Type: text/x-patch
Size: 26729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170329/b9be01ee/attachment.bin>


More information about the llvm-commits mailing list