]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: use the libc allocator for sanitizer builds
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Sun, 21 Jun 2026 16:14:55 +0000 (00:14 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Mon, 22 Jun 2026 02:57:27 +0000 (10:57 +0800)
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 <sunyuechi@iscas.ac.cn>
CMakeLists.txt

index 46a0efc680d15dd8a6c062bdde61bef139846c41..6de3055dc4fd14ce4b74a1f8505e75ca69f6d870 100644 (file)
@@ -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})