This is an archive of the discontinued LLVM Phabricator instance.

[GWP-ASan] Split options_parser and backtrace_sanitizer_common.
ClosedPublic

Authored by hctim on Aug 23 2019, 2:10 PM.

Details

Summary

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().

Diff Detail

Repository
rL LLVM

Event Timeline

hctim created this revision.Aug 23 2019, 2:10 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 23 2019, 2:10 PM
Herald added subscribers: llvm-commits, Restricted Project, mgorny, srhines. · View Herald Transcript
eugenis accepted this revision.Aug 23 2019, 3:24 PM

LGTM

This revision is now accepted and ready to land.Aug 23 2019, 3:24 PM
hctim updated this revision to Diff 216977.Aug 23 2019, 4:21 PM

Merge branch 'master' into gwp_asan/glibc_printf in prep for submission.

This revision was automatically updated to reflect the committed changes.