[PATCH] D66684: [GWP-ASan] Split options_parser and backtrace_sanitizer_common.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 14:13:35 PDT 2019


hctim created this revision.
hctim added a reviewer: eugenis.
Herald added subscribers: llvm-commits, Sanitizers, mgorny, srhines.
Herald added projects: Sanitizers, LLVM.

optional/options_parser and optional/backtrace_sanitizer_common are logically
separate components. They both use sanitizer-common to power their
functionality, but there was an unstated implicit dependency that in order for
backtrace_sanitizer_common to function correctly, one had to also use
options_parser.

This was because options_parser called __sanitizer::InitialiseCommonFlags. This
is a requirement for backtrace_sanitizer_common to work, as the sanitizer
unwinder uses the sanitizer_common flags and will SEGV on a null page if
they're not initialised correctly.

This patch removes this hidden dependency. You can now use
backtrace_sanitizer_common without the requirements of options_parser.

This patch also makes the GWP-ASan unit tests only have a soft dependency on
sanitizer-common. The unit tests previously explicitly used
__sanitizer::Printf, which is now provided under
tests/optional/printf_sanitizer_common. This allows Android to build the unit
tests using their own signal-safe printf().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66684

Files:
  compiler-rt/lib/gwp_asan/optional/backtrace.h
  compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp
  compiler-rt/lib/gwp_asan/options.h
  compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
  compiler-rt/lib/gwp_asan/tests/harness.h
  compiler-rt/lib/gwp_asan/tests/optional/printf_sanitizer_common.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66684.216951.patch
Type: text/x-patch
Size: 7643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190823/f9bf3da8/attachment.bin>


More information about the llvm-commits mailing list