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
This commit is contained in:
sdong 2020-07-10 20:02:16 -07:00 committed by Facebook GitHub Bot
parent a08f4031cb
commit c1935295df
2 changed files with 21 additions and 0 deletions

View File

@ -97,6 +97,18 @@ jobs:
- run: sudo apt-get update -y && sudo apt-get install -y clang-10 libgflags-dev - 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 - 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: build-linux-cmake:
machine: machine:
image: ubuntu-1604:201903-01 image: ubuntu-1604:201903-01
@ -186,6 +198,9 @@ workflows:
build-linux-clang10-asan: build-linux-clang10-asan:
jobs: jobs:
- build-linux-clang10-asan - build-linux-clang10-asan
build-linux-clang10-ubsan:
jobs:
- build-linux-clang10-ubsan
build-linux-cmake: build-linux-cmake:
jobs: jobs:
- build-linux-cmake - build-linux-cmake

View File

@ -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<std::pair<const std::__cxx11::basic_string<char>, rocksdb::(anonymous namespace)::LockHoldingInfo> >'
src:*bits/stl_tree.h