]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: explicitly support and enable vptr sanitizer
authorAishwarya Mathuria <amathuri@redhat.com>
Thu, 26 Feb 2026 11:02:51 +0000 (11:02 +0000)
committerAishwarya Mathuria <amathuri@redhat.com>
Mon, 2 Mar 2026 11:24:44 +0000 (11:24 +0000)
As of Clang 21, -fsanitize=undefined no longer implies vptr.
This adds vptr as an explicit component and provides the necessary compile options to satisfy Seastar's build requirements.
See: https://github.com/scylladb/seastar/commit/c1060ea7d4676df23ce62af96ef2daa768f5de8a for more details

Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
cmake/modules/FindSanitizers.cmake

index 1401ca2442bf475e1ad482457ceb1ee5f3b4375a..c3dcd85bfd7f8c07b264dd95ee8e76e8121c6448 100644 (file)
@@ -1,6 +1,6 @@
 if(NOT Sanitizers_FIND_COMPONENTS)
   set(Sanitizers_FIND_COMPONENTS
-    address undefined_behavior)
+    address undefined_behavior vptr)
 endif()
 if(HAVE_JEMALLOC)
   message(WARNING "JeMalloc does not work well with sanitizers")
@@ -23,7 +23,11 @@ foreach(component ${Sanitizers_FIND_COMPONENTS})
     set(Sanitizers_thread_COMPILE_OPTIONS "-fsanitize=thread")
   elseif(component STREQUAL "undefined_behavior")
     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88684
-    set(Sanitizers_undefined_behavior_COMPILE_OPTIONS "-fsanitize=undefined;-fno-sanitize=vptr")
+    set(Sanitizers_undefined_behavior_COMPILE_OPTIONS "-fsanitize=undefined")
+  elseif (component STREQUAL "vptr")
+    # since Clang version 21, -fsanitize=undefined no longer implies vptr,
+    # so we enable it explicitly
+    set(Sanitizers_vptr_COMPILE_OPTIONS "-fno-sanitize=vptr")
   else()
     message(SEND_ERROR "Unsupported sanitizer: ${component}")
   endif()