From 3623026505515f38279d3e3c8ac0297cc96c62cc Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 11 Feb 2020 14:43:37 +0530 Subject: [PATCH] Switch nightly fuzzer build from ASan (slow) to UBSan (fast) --- .circleci/config.yml | 3 +-- cmake/toolchains/libfuzzer.cmake | 4 ++-- scripts/regressions.py | 8 ++------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9fc35abc..954579033 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -414,7 +414,6 @@ jobs: name: Regression tests command: | mkdir -p test_results - export ASAN_OPTIONS="check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2" scripts/regressions.py -o test_results - run: *gitter_notify_failure - run: *gitter_notify_success @@ -793,7 +792,7 @@ workflows: jobs: # OSSFUZZ builds and (regression) tests - b_ubu_ossfuzz: *workflow_trigger_on_tags -# - t_ubu_ossfuzz: *workflow_ubuntu1904_ossfuzz + - t_ubu_ossfuzz: *workflow_ubuntu1904_ossfuzz # Code Coverage enabled build and tests - b_ubu_codecov: *workflow_trigger_on_tags diff --git a/cmake/toolchains/libfuzzer.cmake b/cmake/toolchains/libfuzzer.cmake index 354e6d09b..53c36d3c9 100644 --- a/cmake/toolchains/libfuzzer.cmake +++ b/cmake/toolchains/libfuzzer.cmake @@ -7,5 +7,5 @@ set(USE_CVC4 OFF CACHE BOOL "Disable CVC4" FORCE) set(OSSFUZZ ON CACHE BOOL "Enable fuzzer build" FORCE) # Use libfuzzer as the fuzzing back-end set(LIB_FUZZING_ENGINE "-fsanitize=fuzzer" CACHE STRING "Use libfuzzer back-end" FORCE) -# clang/libfuzzer specific flags for ASan instrumentation -set(CMAKE_CXX_FLAGS "-O1 -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libstdc++" CACHE STRING "Custom compilation flags" FORCE) +# clang/libfuzzer specific flags for UBSan instrumentation +set(CMAKE_CXX_FLAGS "-O1 -gline-tables-only -fsanitize=undefined -fsanitize=fuzzer-no-link -stdlib=libstdc++" CACHE STRING "Custom compilation flags" FORCE) diff --git a/scripts/regressions.py b/scripts/regressions.py index 42e3b41c6..22a9f1c86 100755 --- a/scripts/regressions.py +++ b/scripts/regressions.py @@ -31,8 +31,7 @@ class PrintDotsThread(object): time.sleep(self.interval) class regressor(): - _re_sanitizer_log = re.compile(r"""ERROR: (?P\w+).*""") - _error_blacklist = ["AddressSanitizer", "libFuzzer"] + _re_sanitizer_log = re.compile(r"""(.*runtime error: (?P\w+).*|std::exception::what: (?P\w+).*)""") def __init__(self, description, args): self._description = description @@ -85,16 +84,13 @@ class regressor(): bool: Test status. True -> Success False -> Failure - int: Number of suppressed memory leaks """ ## Log may contain non ASCII characters, so we simply stringify them ## since they don't matter for regular expression matching rawtext = str(open(logfile, 'rb').read()) list = re.findall(self._re_sanitizer_log, rawtext) - numSuppressedLeaks = list.count("LeakSanitizer") - rv = any(word in list for word in self._error_blacklist) - return not rv, numSuppressedLeaks + return len(list) == 0 def run(self): """