Skip to content

Commit

Permalink
Added suppressions to sanitizers
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarneliuk committed Nov 4, 2023
1 parent 538b59a commit 236e681
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmake/Package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGE_NAME "DLSM")
set(CPACK_PACKAGE_VENDOR "DLSM")
set(CPACK_PACKAGE_VERSION ${DLSM_VERSION})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_BUILD_TYPE}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PACKAGE_DESCRIPTION "DLSM
Version: ${CPACK_PACKAGE_VERSION} ${CMAKE_BUILD_TYPE}
System: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}
Expand Down
6 changes: 4 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

Root=$(realpath $(dirname $(realpath $0))/..)

$Root/scripts/conan/build.sh Debug clang++ "coverage asan usan"
$Root/scripts/conan/build.sh Debug g++ "coverage asan"
$Root/scripts/conan/build.sh Debug clang++ usan
$Root/scripts/conan/build.sh Debug clang++ tsan

$Root/scripts/conan/build.sh Debug g++ "coverage asan usan"
$Root/scripts/conan/build.sh Debug g++ "coverage asan"
$Root/scripts/conan/build.sh Debug g++ usan
$Root/scripts/conan/build.sh Debug g++ tsan

$Root/scripts/conan/build.sh Release clang++
Expand Down
3 changes: 2 additions & 1 deletion scripts/conan/asan
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[buildenv]
CFLAGS +=-fsanitize=address
CXXFLAGS+=-fsanitize=address
ASAN_OPTIONS=detect_leaks=1:allocator_may_return_null=1:detect_stack_use_after_return=1:detect_stack_use_after_scope=1:check_initialization_order=true:strict_init_order=true
LSAN_OPTIONS=suppressions={{os.path.join(profile_dir, "lsan.suppressions")}}
ASAN_OPTIONS=suppressions={{os.path.join(profile_dir, "asan.suppressions")}}:detect_leaks=1:allocator_may_return_null=1:detect_stack_use_after_return=1:detect_stack_use_after_scope=1:check_initialization_order=true:strict_init_order=true
6 changes: 6 additions & 0 deletions scripts/conan/asan.suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AddressSanitizer suppressions, see:
# - https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-reports-in-external-libraries

interceptor_via_fun:-[ClassName Asan_DoubleFree_Test::TestBody:]
interceptor_via_fun:-[ClassName Asan_DoubleFree_Test:]
interceptor_via_fun:*MAdviseAllocator*
1 change: 1 addition & 0 deletions scripts/conan/common
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# See:
# - https://docs.conan.io/2.0/reference/config_files/profiles.html
# - https://docs.conan.io/2.0/reference/config_files/settings.html
# - https://docs.conan.io/2.0/reference/config_files/global_conf.html

[settings]
os=Linux
Expand Down
4 changes: 4 additions & 0 deletions scripts/conan/lsan.suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# LeakSanitizer suppressions, see:
# - https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-memory-leaks

leak:Asan_LeakedAllocation
2 changes: 1 addition & 1 deletion scripts/conan/tsan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[buildenv]
CFLAGS +=-fsanitize=thread
CXXFLAGS+=-fsanitize=thread
TSAN_OPTIONS=allocator_may_return_null=1
TSAN_OPTIONS=suppressions={{os.path.join(profile_dir, "tsan.suppressions")}}:allocator_may_return_null=1
4 changes: 4 additions & 0 deletions scripts/conan/tsan.suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ThreadSanitizer suppressions, see:
# - https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions

race:Tsan_DataRace_Test
2 changes: 1 addition & 1 deletion scripts/conan/usan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[buildenv]
CFLAGS +=-fsanitize=undefined
CXXFLAGS+=-fsanitize=undefined
UBSAN_OPTIONS=symbolize=1:halt_on_error=0:print_stacktrace=1
UBSAN_OPTIONS=suppressions={{os.path.join(profile_dir, "usan.suppressions")}}:symbolize=1:halt_on_error=0:print_stacktrace=1
5 changes: 5 additions & 0 deletions scripts/conan/usan.suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# UndefinedBehaviorSanitizer suppressions, see:
# - https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions

# ZeroMQ
alignment:yqueue.hpp
2 changes: 1 addition & 1 deletion tests/unit/Asan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ TEST(Asan, DISABLED_DoubleFree) {
delete p;
}

TEST(Asan, DISABLED_LeakedAllocation) { new char; }
TEST(Asan, LeakedAllocation) { new char; }
// NOLINTEND

0 comments on commit 236e681

Please sign in to comment.