Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Timur Safin" <tsafin@tarantool.org>
To: 'Vladislav Shpilevoy' <v.shpilevoy@tarantool.org>,
	tarantool-patches@dev.tarantool.org, alyapunov@tarantool.org,
	korablev@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 03/10] cmake: add option ENABLE_UB_SANITIZER
Date: Thu, 28 May 2020 23:42:30 +0300	[thread overview]
Message-ID: <04a501d63530$81a0f500$84e2df00$@tarantool.org> (raw)
In-Reply-To: <645228196cb289f4bbf8e1df47f17ea958cd9237.1590622225.git.v.shpilevoy@tarantool.org>

Very nice!

LGTM!

: -----Original Message-----
: From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
: Sent: Thursday, May 28, 2020 2:32 AM
: To: tarantool-patches@dev.tarantool.org; alyapunov@tarantool.org;
: korablev@tarantool.org; tsafin@tarantool.org
: Subject: [PATCH v2 03/10] cmake: add option ENABLE_UB_SANITIZER
: 
: Clang has a built-in sanitizer for undefined behaviour. Such as
: wrong memory alignment, array boundaries violation, 0 division,
: bool values with non standard content, etc.
: 
: The sanitizer emits runtime checks which lead to either crash, or
: a trap, or a warning print, depending on what is chosen.
: 
: The patch makes it possible to turn the sanitizer on and catch
: UBs. The only supported UB so far is alignment check. Other types
: can be added gradually, along with fixing bugs which they find.
: 
: The UB sanitizer is activated for ASAN builds in CI.
: 
: Part of #4609
: ---
:  .travis.mk           |  3 ++-
:  cmake/compiler.cmake | 10 ++++++++++
:  2 files changed, 12 insertions(+), 1 deletion(-)
: 
: diff --git a/.travis.mk b/.travis.mk
: index 063537f25..748321f26 100644
: --- a/.travis.mk
: +++ b/.travis.mk
: @@ -114,7 +114,8 @@ coverage_debian: deps_debian
: test_coverage_debian_no_deps
: 
:  build_asan_debian:
:  	CC=clang-8 CXX=clang++-8 cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo \
: -		-DENABLE_WERROR=ON -DENABLE_ASAN=ON ${CMAKE_EXTRA_PARAMS}
: +		-DENABLE_WERROR=ON -DENABLE_ASAN=ON -DENABLE_UB_SANITIZER=ON \
: +		${CMAKE_EXTRA_PARAMS}
:  	make -j
: 
:  test_asan_debian_no_deps: build_asan_debian
: diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
: index ce3e7e506..373bcd3b0 100644
: --- a/cmake/compiler.cmake
: +++ b/cmake/compiler.cmake
: @@ -238,6 +238,8 @@ endif()
: 
:  option(ENABLE_WERROR "Make all compiler warnings into errors" OFF)
: 
: +option(ENABLE_UB_SANITIZER "Make the compiler generate runtime code to
: perform undefined behaviour checks" OFF)
: +
:  macro(enable_tnt_compile_flags)
:      # Tarantool code is written in GNU C dialect.
:      # Additionally, compile it with more strict flags than the rest
: @@ -263,6 +265,14 @@ macro(enable_tnt_compile_flags)
:          "-Wno-strict-aliasing"
:      )
: 
: +    if (ENABLE_UB_SANITIZER)
: +        if (NOT CMAKE_COMPILER_IS_CLANG)
: +            message(FATAL_ERROR "Undefined behaviour sanitizer only
: available for clang")
: +        else()
: +            add_compile_flags("C;CXX" "-fsanitize=alignment -fno-
: sanitize-recover=alignment")
: +        endif()
: +    endif()
: +
:      if (CMAKE_COMPILER_IS_CLANG AND CC_HAS_WNO_UNUSED_VALUE)
:          # False-positive warnings for ({ xx = ...; x; }) macroses
:          add_compile_flags("C;CXX" "-Wno-unused-value")
: --
: 2.21.1 (Apple Git-122.3)

  reply	other threads:[~2020-05-28 20:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 23:32 [Tarantool-patches] [PATCH v2 00/10] Sanitize unaligned access Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 01/10] small: sanitized rlist and new region API Vladislav Shpilevoy
2020-05-28 20:41   ` Timur Safin
2020-05-28 22:56     ` Vladislav Shpilevoy
2020-06-08 23:01   ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 10/10] xrow: use unaligned store operation in xrow_to_iovec() Vladislav Shpilevoy
2020-05-28 20:20   ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 02/10] cmake: ignore warnings on alignof() and offsetof() Vladislav Shpilevoy
2020-05-28 20:18   ` Timur Safin
2020-05-29  6:24   ` Kirill Yukhin
2020-05-29 22:34     ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 03/10] cmake: add option ENABLE_UB_SANITIZER Vladislav Shpilevoy
2020-05-28 20:42   ` Timur Safin [this message]
2020-05-29  8:53   ` Sergey Bronnikov
2020-05-29 22:36     ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 04/10] crc32: align memory access Vladislav Shpilevoy
2020-05-28 20:11   ` Timur Safin
2020-05-28 23:23     ` Vladislav Shpilevoy
2020-05-28 23:32       ` Timur Safin
2020-06-08 22:33       ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 05/10] sql: make BtCursor's memory aligned Vladislav Shpilevoy
2020-05-28 20:20   ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 06/10] region: use aligned allocations where necessary Vladislav Shpilevoy
2020-05-28 20:35   ` Timur Safin
2020-05-28 23:07     ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 07/10] vinyl: align statements and bps tree extents Vladislav Shpilevoy
2020-05-28 20:38   ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 08/10] tuple: use unaligned store-load for field map Vladislav Shpilevoy
2020-05-28 20:22   ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 09/10] port: make port_c_entry not PACKED Vladislav Shpilevoy
2020-05-28 20:42   ` Timur Safin
2020-06-03 21:27 ` [Tarantool-patches] [PATCH v2 00/10] Sanitize unaligned access Vladislav Shpilevoy
2020-06-08 22:33 ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='04a501d63530$81a0f500$84e2df00$@tarantool.org' \
    --to=tsafin@tarantool.org \
    --cc=alyapunov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 03/10] cmake: add option ENABLE_UB_SANITIZER' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox