Skip to content

Commit

Permalink
Fix build issues with gcc5.x
Browse files Browse the repository at this point in the history
Summary:
Fixing the following issues when building with gcc5.x:
- TSAN: no longer requires to be built with -pie. Based on
  google/sanitizers#503
- UBSAN: gcc5 introduced a new vptr santizer in UBSAN, which will generate some
  false alarms about "undefined reference" during linking. Suppressing vptr
  sanitizer.
- Valgrind: Added new suppression rules
- ASAN: (suppression added in tools)

Test Plan: manual build and sandcastle

Reviewers: gunnarku

Reviewed By: gunnarku

Subscribers: webscalesql-eng@fb.com

Differential Revision: https://phabricator.intern.facebook.com/D5039367

Tasks: 18077031, 17217920, 18077885, 17553023

Signature: t1:5039367:1494528829:2a650d7e39032bf3ce5cb4180617fdbc90adf359
  • Loading branch information
tianx committed May 11, 2017
1 parent 896a4c7 commit 00ab2ca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@ IF(WITH_FB_TSAN)
# 2. We need to pass in both flags for the MY_CHECK_* function to succeed.
# 3. Eventually -fPIC will be duplicated on the command-line, but that's OK.
#
MY_SANITIZER_CHECK("-fsanitize=thread -fPIC -pie" WITH_FB_TSAN_OK)
IF (CMAKE_C_COMPILER_ID MATCHES "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
MY_SANITIZER_CHECK("-fsanitize=thread -fPIC -pie" WITH_FB_TSAN_OK)
ELSE()
MY_SANITIZER_CHECK("-fsanitize=thread -fPIC" WITH_FB_TSAN_OK)
ENDIF()
IF(NOT WITH_FB_TSAN_OK)
MESSAGE(FATAL_ERROR
"Do not know how to enable internal thread sanitizer (TSan).")
Expand All @@ -319,7 +324,12 @@ ENDIF()

OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF)
IF(WITH_UBSAN)
MY_SANITIZER_CHECK("-fsanitize=undefined" WITH_UBSAN_OK)
IF (CMAKE_C_COMPILER_ID MATCHES "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
MY_SANITIZER_CHECK("-fsanitize=undefined" WITH_UBSAN_OK)
ELSE()
MY_SANITIZER_CHECK("-fsanitize=undefined -fno-sanitize=vptr" WITH_UBSAN_OK)
ENDIF()
IF(NOT WITH_UBSAN_OK)
MESSAGE(FATAL_ERROR
"Do not know how to enable undefined behavior sanitizer (UBSan).")
Expand Down
21 changes: 21 additions & 0 deletions mysql-test/valgrind.supp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@
fun:_dl_init
}

{
_dl_init/malloc loss record
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
...
fun:_dl_init
...
}

{
init invalid write8
Memcheck:Addr8
Expand Down Expand Up @@ -1100,6 +1110,17 @@
fun:main
}

{
TLS data on main thread is not cleaned up properly
Memcheck:Leak
match-leak-kinds: reachable
fun:calloc
...
fun:err_get_state
...
fun:main
}

{
TLS data on main thread is not cleaned up properly
Memcheck:Leak
Expand Down

0 comments on commit 00ab2ca

Please sign in to comment.