From 61d57901b135080d8c0216f1e299f879560bb999 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 29 Jul 2024 13:09:41 +0200 Subject: [PATCH] Enable undefined behavior sanitizer in CI --- .gitlab-ci.yml | 7 +++++++ CMakeLists.txt | 4 +++- flake.nix | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 118da17..9c60f15 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,6 +42,13 @@ build:asan: script: - nix build -L --no-link .#ovniPackages.asan +build:ubsan: + stage: build + tags: + - nix + script: + - nix build -L --no-link .#ovniPackages.ubsan + build:nompi: stage: build tags: diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a998d4..e5b447e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,9 @@ set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_DEBUG} \ -fno-omit-frame-pointer" CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." FORCE) -set(CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined" +set(CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_DEBUG} \ + -fsanitize=undefined \ + -fno-sanitize-recover=all" CACHE STRING "Flags used by the C compiler during UndefinedBehaviorSanitizer builds." FORCE) find_program(IWYU NAMES include-what-you-use iwyu) diff --git a/flake.nix b/flake.nix index 7b3b10b..6ab9518 100644 --- a/flake.nix +++ b/flake.nix @@ -136,6 +136,11 @@ ''; }); + ubsan = rt.overrideAttrs (old: { + pname = "ovni-ubsan"; + cmakeFlags = old.cmakeFlags ++ [ "-DCMAKE_BUILD_TYPE=Ubsan" ]; + }); + armv7 = (pkgs.pkgsCross.armv7l-hf-multiplatform.ovniLocal.overrideAttrs (old: { pname = "ovni-armv7"; buildInputs = [];