From: Kefu Chai Date: Tue, 23 Jun 2026 08:14:19 +0000 (+0800) Subject: ceph.in: load asan/lsan suppressions on WITH_ASAN builds X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=55ac10180cd3a1bb202c8132c4caca30404bb6f8;p=ceph.git ceph.in: load asan/lsan suppressions on WITH_ASAN builds bin/ceph from a WITH_ASAN build aborts at exit, with LeakSanitizer reporting CPython and Cython module-init allocations as leaks: ==2577940==ERROR: LeakSanitizer: detected memory leaks Direct leak ... in PyObject_Malloc (/usr/bin/python3.12+...) #4 __pyx_pymod_exec_rados rados_processed.c SUMMARY: AddressSanitizer: 32113 byte(s) leaked in 30 allocation(s). These are interpreter globals that live for the process lifetime. qa/lsan.supp already suppresses them, but bin/ceph never loaded it: vstart.sh sets LSAN_OPTIONS for the daemons it spawns, while a bin/ceph invoked separately (ceph-api runs ./bin/ceph fsid once vstart.sh returns) inherits none and exits non-zero. It stayed hidden until radosgw-admin stopped crashing in vstart and the run reached that call. ceph.in already re-execs with the ASan runtime preloaded under WITH_ASAN. Set ASAN_OPTIONS and LSAN_OPTIONS first, from the CEPH_ASAN_OPTIONS and CEPH_LSAN_OPTIONS that CMake also feeds add_ceph_test(), so the re-exec'd interpreter starts with the suppressions loaded. Use setdefault so a value from the caller still wins. Signed-off-by: Kefu Chai --- diff --git a/src/ceph.in b/src/ceph.in index 4694da29db5..069888422c0 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -140,6 +140,13 @@ if os.path.exists(os.path.join(MYPDIR, "CMakeCache.txt")) \ pythonlib_path = os.path.join(lib_path, "cython_modules", get_pythonlib_dir()) + if with_asan: + # respawn_in_path() below re-execs with the ASan runtime preloaded. + # Load the same suppression options add_ceph_test() uses (configured + # by CMake) first, so the re-exec'd interpreter does not report + # CPython/Cython module-init allocations as leaks at exit. + os.environ.setdefault("ASAN_OPTIONS", "@CEPH_ASAN_OPTIONS@") + os.environ.setdefault("LSAN_OPTIONS", "@CEPH_LSAN_OPTIONS@") respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path if with_asan else None)