[libcxx] [llvm] [libc++] Add a new job running the CFI sanitizer (PR #124837)

Louis Dionne via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 12:49:48 PDT 2026


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/124837

>From f7bd2acb82b7bffb0cc7c2a8a06dd6b1138ba48c Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 28 Jan 2025 16:06:58 -0500
Subject: [PATCH] [libc++] Add a new job running the CFI sanitizer

---
 .github/workflows/libcxx-pr-conformance-tests.yaml | 1 +
 libcxx/cmake/caches/Generic-cfisan.cmake           | 1 +
 libcxx/utils/ci/run-buildbot                       | 5 +++++
 libcxx/utils/libcxx/test/params.py                 | 4 ++++
 4 files changed, 11 insertions(+)
 create mode 100644 libcxx/cmake/caches/Generic-cfisan.cmake

diff --git a/.github/workflows/libcxx-pr-conformance-tests.yaml b/.github/workflows/libcxx-pr-conformance-tests.yaml
index a7a93a110428c..e800e45debff1 100644
--- a/.github/workflows/libcxx-pr-conformance-tests.yaml
+++ b/.github/workflows/libcxx-pr-conformance-tests.yaml
@@ -162,6 +162,7 @@ jobs:
           'generic-static',
           'generic-asan',
           'generic-asan-in-tests-only',
+          'generic-cfisan',
           'generic-tsan',
           'generic-ubsan',
           'generic-msan',
diff --git a/libcxx/cmake/caches/Generic-cfisan.cmake b/libcxx/cmake/caches/Generic-cfisan.cmake
new file mode 100644
index 0000000000000..150bf9845720b
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-cfisan.cmake
@@ -0,0 +1 @@
+set(LLVM_USE_SANITIZER "CFI" CACHE STRING "")
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index d47061f3e1947..1c5370091de9c 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -450,6 +450,11 @@ generic-ubsan)
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
     check-runtimes
 ;;
+generic-cfisan)
+    clean
+    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cfisan.cmake"
+    check-runtimes
+;;
 #
 # Various build configurations
 #
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 21c88e4ea667f..73f725e957395 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -303,6 +303,7 @@ def getSuitableClangTidy(cfg):
             "",
             "Address",
             "HWAddress",
+            "CFI",
             "Undefined",
             "Memory",
             "MemoryWithOrigins",
@@ -327,6 +328,9 @@ def getSuitableClangTidy(cfg):
                 AddFlag("-fsanitize=hwaddress") if sanitizer == "HWAddress" else None,
                 AddFeature("hwasan")            if sanitizer == "HWAddress" else None,
 
+                AddFlag("-fsanitize=cfi") if sanitizer == "CFI" else None,
+                AddFeature("cfi")         if sanitizer == "CFI" else None,
+
                 AddFlag("-fsanitize=memory")               if sanitizer in ["Memory", "MemoryWithOrigins"] else None,
                 AddFeature("msan")                         if sanitizer in ["Memory", "MemoryWithOrigins"] else None,
                 AddFlag("-fsanitize-memory-track-origins") if sanitizer == "MemoryWithOrigins" else None,



More information about the llvm-commits mailing list