From 46a6b74ee0d0812d2c538bb16dd7275ac30bb612 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 10 Apr 2020 17:58:08 +0200 Subject: [PATCH] remove home-built sanitizer support, use boost-build features --- .travis.yml | 21 +++++++------------ Jamfile | 55 ------------------------------------------------- fuzzers/Jamfile | 7 ++++--- 3 files changed, 11 insertions(+), 72 deletions(-) diff --git a/.travis.yml b/.travis.yml index e9a1957e4..ef8891710 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,8 @@ matrix: apt: packages: - python3-pip - - env: variant=test_debug tests=1 toolset=gcc-sanitizer fuzzers=1 - - env: variant=test_debug sim=1 crypto=openssl toolset=gcc-sanitizer + - env: variant=test_debug tests=1 toolset=gcc sanitizer=on fuzzers=1 + - env: variant=test_debug sim=1 crypto=openssl toolset=gcc sanitizer=on - env: variant=test_release coverage=1 tests=1 toolset=gcc-coverage - env: autotools=1 toolset=gcc install_boost=1 - env: cmake=1 toolset=gcc install_boost=1 @@ -88,6 +88,7 @@ before_install: - cd $TRAVIS_BUILD_DIR - git submodule update --init --recursive - 'if [[ $crypto == "" ]]; then export crypto=built-in; fi' + - 'if [[ $sanitizer == "" ]]; then export sanitizer=off; fi' - 'if [[ $TRAVIS_OS_NAME == "osx" ]]; then travis_retry brew update > /dev/null && brew install ccache; fi' @@ -133,17 +134,6 @@ install: g++ --version; echo "using gcc : : ccache g++ : -std=c++11 ;" >> ~/user-config.jam; fi' - - 'if [[ $toolset == "gcc-sanitizer" ]]; then - echo "using gcc : sanitizer : ccache g++ : - -std=c++11 - -fstack-protector-all - -fstack-check - -fsanitize=address,undefined - -fno-sanitize-recover=address,undefined - -fsanitize=address,undefined - -fno-sanitize-recover=address,undefined - -fuse-ld=gold ;" >> ~/user-config.jam; - fi' - 'if [[ $toolset == "gcc-coverage" ]]; then echo "using gcc : coverage : ccache g++ --coverage : -std=c++11 --coverage ;" >> ~/user-config.jam; fi' @@ -250,6 +240,9 @@ script: # the common boost-build command line arguments. It's important they are all # the same, in order for builds to be reused between invocations - export B2_ARGS="crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant" + - 'if [[ $sanitizer == "on" ]]; then + export B2_ARGS="${B2_ARGS} address-sanitizer=norecover undefined-sanitizer=norecover"; + fi' - 'if [[ $TRAVIS_OS_NAME == "osx" && "$crypto" == "openssl" ]]; then export B2_ARGS="${B2_ARGS} openssl-lib=/usr/local/opt/openssl@1.1/lib openssl-include=/usr/local/opt/openssl@1.1/include" ; @@ -278,7 +271,7 @@ script: # rebuilding libtorrent itself. - cd ../fuzzers - 'if [ "$fuzzers" == "1" ]; then - ${B2} -j2 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant sanitize=off fuzz=off link=shared stage; + ${B2} -j2 warnings-as-errors=on warnings=all crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant fuzz=off link=shared stage; fi' - cd ../examples diff --git a/Jamfile b/Jamfile index 0ec171f47..0f580a2af 100644 --- a/Jamfile +++ b/Jamfile @@ -379,63 +379,9 @@ rule openssl-include-path ( properties * ) return $(result) ; } -path-constant blacklist-file : tools/sanitizer-blacklist.txt ; - -rule sanitizer-options ( properties * ) -{ - local result ; - if on in $(properties) - { - local sanitizers ; - local extra ; - local flags ; - - # sanitize is a clang and GCC feature - if clang in $(properties) - { - local version = [ feature.get-values : $(properties) ] ; - # implicit-conversion sanitizer was added in clang-7 - if $(version) >= 7.0 { - sanitizers += address,undefined,leak,implicit-conversion ; - } - else { - sanitizers += address,undefined,leak ; - } - extra = -fsanitize-blacklist=$(blacklist-file) ; - flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ; - } - # sanitizers are not available on windows (mingw) - else if gcc in $(properties) && ! windows in $(properties) - { - local version = [ feature.get-values : $(properties) ] ; - if $(version) >= 7.0 { - extra = -fsanitize-address-use-after-scope ; - } - if $(version) >= 5.0 { - sanitizers = address,undefined,leak ; - flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ; - } - } - else if darwin in $(properties) - { - # apple's compiler is typically an old version of clang - sanitizers = address,undefined ; - flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ; - } - - result = $(flags) $(flags) $(extra) ; - } - return $(result) ; -} - feature openssl-lib : : free path ; feature openssl-include : : free path ; -feature sanitize : off rtc on : composite propagated link-incompatible ; - -# RTC (runtime check) is an msvc feature -feature.compose rtc : /RTCc /RTCsu ; - feature test-coverage : off on : composite propagated link-incompatible ; feature.compose on : --coverage --coverage ; @@ -791,7 +737,6 @@ local usage-requirements = # make sure asio uses std::chrono BOOST_ASIO_HAS_STD_CHRONO @linking - @sanitizer-options # msvc optimizations msvc,release:"/OPT:ICF=5" msvc,release:"/OPT:REF" diff --git a/fuzzers/Jamfile b/fuzzers/Jamfile index b661f1dd6..5c7912015 100644 --- a/fuzzers/Jamfile +++ b/fuzzers/Jamfile @@ -12,9 +12,9 @@ feature fuzz : off external on : composite propagated link-incompatible ; feature.compose on : -fsanitize=fuzzer -fsanitize=fuzzer ; # this is a build configuration that only does limited validation (i.e. no -# sanitizers, invariant-checks, asserts etc.). The purpose is to quickly iterate +# invariant-checks, asserts etc.). The purpose is to quickly iterate # on inputs to build code coverage -variant build_coverage : release : off on off off ; +variant build_coverage : release : on off off ; project fuzzers : requirements @@ -28,7 +28,8 @@ project fuzzers /torrent//torrent/ : default-build on - on + norecover + norecover static release on