From c1935295dfeb1414ee9fcf413041c40740e82bff Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 10 Jul 2020 20:02:16 -0700 Subject: [PATCH] Add ubsan_check to CircleCI runs (#7112) Summary: It is useful to run UBSAN before merging a PR. This commit adds it. We see warning for stl_tree.h, suppress the warning to make it work. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7112 Test Plan: See the CI to succeed. Manually ingest a UBSAN warning and see it got reported. Reviewed By: pdillinger Differential Revision: D22490519 fbshipit-source-id: e4495a0c78a3e2dae7dbf294da79585e141cbb66 --- .circleci/config.yml | 15 +++++++++++++++ .circleci/ubsan_suppression_list.txt | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 .circleci/ubsan_suppression_list.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index ec4483ff5..6d5f60c17 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,6 +97,18 @@ jobs: - run: sudo apt-get update -y && sudo apt-get install -y clang-10 libgflags-dev - run: SKIP_FORMAT_BUCK_CHECKS=1 COMPILE_WITH_ASAN=1 CC=clang-10 CXX=clang++-10 ROCKSDB_DISABLE_ALIGNED_NEW=1 USE_CLANG=1 PRINT_PARALLEL_OUTPUTS=1 make V=1 -j32 check | .circleci/cat_ignore_eagain # aligned new doesn't work for reason we haven't figured out + build-linux-clang10-ubsan: + machine: + image: ubuntu-1604:201903-01 + resource_class: 2xlarge + steps: + - checkout # check out the code in the project directory + - run: pyenv global 3.5.2 + - run: echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" | sudo tee -a /etc/apt/sources.list + - run: echo "deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" | sudo tee -a /etc/apt/sources.list + - run: sudo apt-get update -y && sudo apt-get install -y clang-10 libgflags-dev + - run: SKIP_FORMAT_BUCK_CHECKS=1 COMPILE_WITH_UBSAN=1 OPT="-fsanitize-blacklist=.circleci/ubsan_suppression_list.txt" CC=clang-10 CXX=clang++-10 ROCKSDB_DISABLE_ALIGNED_NEW=1 USE_CLANG=1 PRINT_PARALLEL_OUTPUTS=1 make V=1 -j32 ubsan_check | .circleci/cat_ignore_eagain # aligned new doesn't work for reason we haven't figured out + build-linux-cmake: machine: image: ubuntu-1604:201903-01 @@ -186,6 +198,9 @@ workflows: build-linux-clang10-asan: jobs: - build-linux-clang10-asan + build-linux-clang10-ubsan: + jobs: + - build-linux-clang10-ubsan build-linux-cmake: jobs: - build-linux-cmake diff --git a/.circleci/ubsan_suppression_list.txt b/.circleci/ubsan_suppression_list.txt new file mode 100644 index 000000000..d7db81806 --- /dev/null +++ b/.circleci/ubsan_suppression_list.txt @@ -0,0 +1,6 @@ +# Supress UBSAN warnings related to stl_tree.h, e.g. +# UndefinedBehaviorSanitizer: undefined-behavior /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_tree.h:1505:43 in +# /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_tree.h:1505:43: +# runtime error: upcast of address 0x000001fa8820 with insufficient space for an object of type +# 'std::_Rb_tree_node, rocksdb::(anonymous namespace)::LockHoldingInfo> >' +src:*bits/stl_tree.h