From 2a6cfefb0f537f81af5ed29e4be164e5c7cee8e2 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Wed, 15 May 2024 13:17:57 +0900 Subject: [PATCH] Enable ASan on CI Rocky preset (#11332) --- CMakeLists.txt | 4 ++-- CMakePresets.json | 5 ++--- ci/asan_leak_suppression/regression.txt | 3 +++ .../image_magic_dlopen_leak_suppression.txt | 1 + .../uri_signing/unit_tests/CMakeLists.txt | 4 ++++ .../uri_signing_test_leak_suppression.txt | 21 +++++++++++++++++++ .../image_magic_dlopen_leak_suppression.txt | 3 +++ 7 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1930b51fd6f..89f7f6cad72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,8 +327,8 @@ if(ENABLE_ASAN) if(ENABLE_JEMALLOC OR ENABLE_MIMALLOC) message(FATAL_ERROR "ENABLE_JEMALLOC and ENABLE_MIMALLOC are not compatible with asan builds") endif() - add_compile_options(-fsanitize=address -fno-omit-frame-pointer) - add_link_options(-fsanitize=address) + add_compile_options(-g -fsanitize=address -fno-omit-frame-pointer) + add_link_options(-g -fsanitize=address) endif() if(ENABLE_PROBES) diff --git a/CMakePresets.json b/CMakePresets.json index aad0eccaa17..ceaea5737f8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -77,8 +77,7 @@ "name": "asan", "hidden": true, "cacheVariables": { - "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address,undefined", - "CMAKE_C_FLAGS_DEBUG": "-g -fsanitize=address,undefined" + "ENABLE_ASAN": "ON" } }, { @@ -145,7 +144,7 @@ "name": "ci-rocky", "displayName": "CI Rocky", "description": "CI Pipeline config for Rocky Linux", - "inherits": ["ci"], + "inherits": ["ci", "asan"], "cacheVariables": { "OPENSSL_ROOT_DIR": "/opt/h3-tools-boringssl/boringssl", "quiche_ROOT": "/opt/h3-tools-boringssl/quiche", diff --git a/ci/asan_leak_suppression/regression.txt b/ci/asan_leak_suppression/regression.txt index 4f750d01650..4e98783f675 100644 --- a/ci/asan_leak_suppression/regression.txt +++ b/ci/asan_leak_suppression/regression.txt @@ -18,3 +18,6 @@ leak:RegressionTest_SDK_API_TSPortDescriptor leak:RegressionTest_HostDBProcessor leak:RegressionTest_DNS leak:RegressionTest_UDPNet_echo +leak:HttpConfig::startup +# libswoc +leak:MemArena::make_block diff --git a/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt b/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt index a187337c190..b6910146ee0 100644 --- a/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt +++ b/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt @@ -19,3 +19,4 @@ # plugin itself is not leaking because all other code for the plugin had been # commented out so there was nothing to leak in the plugin. leak:plugin_dso_load +leak:libquiche.so diff --git a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt index e53460ff8b7..464ecce74af 100644 --- a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt +++ b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt @@ -47,3 +47,7 @@ target_link_libraries( OpenSSL::Crypto ) add_test(NAME uri_signing_test COMMAND uri_signing_test) +set_tests_properties( + uri_signing_test + PROPERTIES ENVIRONMENT "LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt" +) diff --git a/plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt b/plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt new file mode 100644 index 00000000000..8a693529722 --- /dev/null +++ b/plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# dlopen of plugins that link with ImageMagick results in ASan reporting a leak +# for the verify_global tests for those plugins. It has been verified that the +# plugin itself is not leaking because all other code for the plugin had been +# commented out so there was nothing to leak in the plugin. +leak:libcjose.so diff --git a/plugins/webp_transform/image_magic_dlopen_leak_suppression.txt b/plugins/webp_transform/image_magic_dlopen_leak_suppression.txt index a187337c190..6d9d5dbabf6 100644 --- a/plugins/webp_transform/image_magic_dlopen_leak_suppression.txt +++ b/plugins/webp_transform/image_magic_dlopen_leak_suppression.txt @@ -19,3 +19,6 @@ # plugin itself is not leaking because all other code for the plugin had been # commented out so there was nothing to leak in the plugin. leak:plugin_dso_load + +leak:libquiche.so +