Repository: impala Updated Branches: refs/heads/master 5d672457c -> e8a669bf9
IMPALA-7129: Fixing path to UBSAN suppressions. This pins the suppression file path at build time. It turns out that calling getenv("IMPALA_HOME") was returning null at the time the undefined behavior was being initialized. I suspect this is an initialization ordering issue. To step around the issue, I'm simply using a preprocessor macro to get at the suppression file path. I was able to reproduce the error by running the catalogd binary outside of $IMPALA_HOME. Before this change, that would fail reliably. Change-Id: I5295c2d1bddbea585a761b85a51eadecf10d191d Reviewed-on: http://gerrit.cloudera.org:8080/10895 Reviewed-by: Jim Apple <jbapple-imp...@apache.org> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/9b4e6d82 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/9b4e6d82 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/9b4e6d82 Branch: refs/heads/master Commit: 9b4e6d82219ed1cccfdc6e735000183b6a7f866b Parents: 5d67245 Author: Philip Zeyliger <phi...@cloudera.com> Authored: Mon Jul 9 14:22:27 2018 -0700 Committer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Committed: Thu Jul 12 01:08:13 2018 +0000 ---------------------------------------------------------------------- be/CMakeLists.txt | 8 +++++++- be/src/common/init.cc | 5 +---- 2 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/9b4e6d82/be/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index da78dad..faefadc 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -112,7 +112,13 @@ SET(CXX_FLAGS_ADDRESS_SANITIZER # Set the flags to the undefined behavior sanitizer, also known as "ubsan" # Turn on sanitizer and debug symbols to get stack traces: -SET(CXX_FLAGS_UBSAN "${CXX_CLANG_FLAGS} -ggdb3 -fno-omit-frame-pointer -fsanitize=undefined -DUNDEFINED_SANITIZER") +SET(CXX_FLAGS_UBSAN "${CXX_CLANG_FLAGS} -ggdb3 -fno-omit-frame-pointer -fsanitize=undefined") +# Set preprocessor macros to facilitate initialization the relevant configuration. +SET(CXX_FLAGS_UBSAN "${CXX_FLAGS_UBSAN} -DUNDEFINED_SANITIZER") +# Calling getenv() in __ubsan_default_options doesn't work, likely because of +# initialization ordering. We need to double-quote to create a macro that expands +# to a string-literal. +SET(CXX_FLAGS_UBSAN "${CXX_FLAGS_UBSAN} -DUNDEFINED_SANITIZER_SUPPRESSIONS=\\\"$ENV{IMPALA_HOME}/bin/ubsan-suppressions.txt\\\"") # Add flags to enable symbol resolution in the stack traces: SET(CXX_FLAGS_UBSAN "${CXX_FLAGS_UBSAN} -rtlib=compiler-rt -lgcc_s") # Ignore a number of noisy errors with too many false positives: http://git-wip-us.apache.org/repos/asf/impala/blob/9b4e6d82/be/src/common/init.cc ---------------------------------------------------------------------- diff --git a/be/src/common/init.cc b/be/src/common/init.cc index 30c194e..ffbb165 100644 --- a/be/src/common/init.cc +++ b/be/src/common/init.cc @@ -304,9 +304,6 @@ extern "C" const char *__tsan_default_options() { // Default UBSAN_OPTIONS. Override by setting environment variable $UBSAN_OPTIONS. #if defined(UNDEFINED_SANITIZER) extern "C" const char *__ubsan_default_options() { - static const string default_options = Substitute( - "print_stacktrace=1 suppressions=$0/bin/ubsan-suppressions.txt", - getenv("IMPALA_HOME") == nullptr ? "." : getenv("IMPALA_HOME")); - return default_options.c_str(); + return "print_stacktrace=1 suppressions=" UNDEFINED_SANITIZER_SUPPRESSIONS; } #endif