From: Sun Yuechi Date: Sun, 21 Jun 2026 16:14:55 +0000 (+0800) Subject: cmake: use the libc allocator for sanitizer builds X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=82162c04bb714610f5ec6dbaa4f233eb0493d997;p=ceph.git cmake: use the libc allocator for sanitizer builds tcmalloc/jemalloc keep exporting the global operator new/delete even though their malloc is shadowed by the sanitizer interceptor, so memory the sanitizer allocated gets freed through tcmalloc and SIGSEGVs (e.g. seastar coroutine frames). Force libc when WITH_ASAN is set. Signed-off-by: Sun Yuechi --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 46a0efc680d..6de3055dc4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,6 +460,10 @@ if(ALLOCATOR) elseif(NOT ALLOCATOR STREQUAL "libc") message(FATAL_ERROR "Unsupported allocator selected: ${ALLOCATOR}") endif() +elseif(WITH_ASAN) + # Force libc: tcmalloc/jemalloc still export operator new/delete even when the + # sanitizer shadows malloc, so sanitizer-allocated memory is freed via tcmalloc and SIGSEGVs. + set(ALLOCATOR "libc") else(ALLOCATOR) find_package(gperftools 2.6.2) set(HAVE_LIBTCMALLOC ${gperftools_FOUND})