From 53674e9d970ebea0ff4df473e9776a76c95381db Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Wed, 8 May 2024 14:06:47 -0600 Subject: [PATCH 1/7] Enable ASan on CI Rocky preset --- CMakePresets.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index af0f100c032..33f7ef606cc 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -151,7 +151,9 @@ "quiche_ROOT": "/opt/h3-tools-boringssl/quiche", "CMAKE_INSTALL_PREFIX": "/tmp/ats-quiche", "opentelemetry_ROOT": "/opt", - "ENABLE_QUICHE": "ON" + "ENABLE_QUICHE": "ON", + "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address", + "CMAKE_C_FLAGS_DEBUG": "-g -fsanitize=address" } }, { From 951b8731155f87b55b55e8623ffcc60a0115863a Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Thu, 9 May 2024 15:44:11 -0600 Subject: [PATCH 2/7] Suppress leak of libquiche.so and libcjose.so --- ci/asan_leak_suppression/unit_tests.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/asan_leak_suppression/unit_tests.txt b/ci/asan_leak_suppression/unit_tests.txt index da34e83c615..5ae01be9cb4 100644 --- a/ci/asan_leak_suppression/unit_tests.txt +++ b/ci/asan_leak_suppression/unit_tests.txt @@ -8,3 +8,6 @@ leak:ConsCell leak:pcre_jit_stack_alloc # PR#10541 leak:test_http_hdr_print_and_copy_aux + +leak:libquiche.so +leak:libcjose.so From a966367d709d0b2d9890d08bcb51fde9b10d8168 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Mon, 13 May 2024 11:44:34 +0900 Subject: [PATCH 3/7] Use ENABLE_ASAN and fix leak suppressions --- CMakeLists.txt | 4 ++-- CMakePresets.json | 9 +++----- ci/asan_leak_suppression/unit_tests.txt | 3 --- .../image_magic_dlopen_leak_suppression.txt | 1 + .../uri_signing_test_leak_suppression.txt | 21 +++++++++++++++++++ .../image_magic_dlopen_leak_suppression.txt | 3 +++ 6 files changed, 30 insertions(+), 11 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 8453384dfef..a36934e2204 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,8 +322,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() set(TS_USE_MALLOC_ALLOCATOR ${ENABLE_MALLOC_ALLOCATOR}) diff --git a/CMakePresets.json b/CMakePresets.json index 33f7ef606cc..71fbfd75182 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,15 +144,13 @@ "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", "CMAKE_INSTALL_PREFIX": "/tmp/ats-quiche", "opentelemetry_ROOT": "/opt", - "ENABLE_QUICHE": "ON", - "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address", - "CMAKE_C_FLAGS_DEBUG": "-g -fsanitize=address" + "ENABLE_QUICHE": "ON" } }, { diff --git a/ci/asan_leak_suppression/unit_tests.txt b/ci/asan_leak_suppression/unit_tests.txt index 5ae01be9cb4..da34e83c615 100644 --- a/ci/asan_leak_suppression/unit_tests.txt +++ b/ci/asan_leak_suppression/unit_tests.txt @@ -8,6 +8,3 @@ leak:ConsCell leak:pcre_jit_stack_alloc # PR#10541 leak:test_http_hdr_print_and_copy_aux - -leak:libquiche.so -leak:libcjose.so 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/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 + From 1e0b0a11f55abc8ab1aea6630c4726c0901aaeb1 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Mon, 13 May 2024 14:33:22 +0900 Subject: [PATCH 4/7] ASAN_OPTIONS --- plugins/experimental/uri_signing/unit_tests/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt index e53460ff8b7..f0371ff3de1 100644 --- a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt +++ b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt @@ -47,3 +47,5 @@ target_link_libraries( OpenSSL::Crypto ) add_test(NAME uri_signing_test COMMAND uri_signing_test) +set_tests_properties(uri_signing_test PROPERTIES ENVIRONMENT "ASAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt") + From f557db087c33aa2757d76e1d1bc934b33472537f Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Mon, 13 May 2024 14:44:15 +0900 Subject: [PATCH 5/7] Fix format --- plugins/experimental/uri_signing/unit_tests/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt index f0371ff3de1..a2f96e3359c 100644 --- a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt +++ b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt @@ -47,5 +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 "ASAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt") - +set_tests_properties( + uri_signing_test + PROPERTIES ENVIRONMENT "ASAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt" +) From 986e0416bd139b09a47c7346fe8b63b46ff54536 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Mon, 13 May 2024 14:45:44 +0900 Subject: [PATCH 6/7] LSAN_OPTIONS --- plugins/experimental/uri_signing/unit_tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt index a2f96e3359c..464ecce74af 100644 --- a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt +++ b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt @@ -49,5 +49,5 @@ target_link_libraries( add_test(NAME uri_signing_test COMMAND uri_signing_test) set_tests_properties( uri_signing_test - PROPERTIES ENVIRONMENT "ASAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt" + PROPERTIES ENVIRONMENT "LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt" ) From 3487f736ecac140eda6554376efe0f4c21230421 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Wed, 15 May 2024 10:09:37 +0900 Subject: [PATCH 7/7] Add leak suppressions for regression test --- ci/asan_leak_suppression/regression.txt | 3 +++ 1 file changed, 3 insertions(+) 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