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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 28 13:07:53 PST 2025


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

None

>From e91c0d3b645806f3fca7d72050bca0931010c869 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-build-and-test.yaml | 2 ++
 libcxx/cmake/caches/Generic-cfisan.cmake     | 1 +
 libcxx/utils/ci/run-buildbot                 | 5 +++++
 libcxx/utils/libcxx/test/params.py           | 4 ++++
 4 files changed, 12 insertions(+)
 create mode 100644 libcxx/cmake/caches/Generic-cfisan.cmake

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index ee77e83363d37a..4544e82e3043d5 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -155,6 +155,8 @@ jobs:
           machine: libcxx-self-hosted-linux
         - config: 'generic-asan'
           machine: libcxx-self-hosted-linux
+        - config: 'generic-cfisan'
+          machine: libcxx-self-hosted-linux
         - config: 'generic-tsan'
           machine: libcxx-self-hosted-linux
         - config: 'generic-ubsan'
diff --git a/libcxx/cmake/caches/Generic-cfisan.cmake b/libcxx/cmake/caches/Generic-cfisan.cmake
new file mode 100644
index 00000000000000..150bf9845720b4
--- /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 f1ede6474eb9ee..8a2a2fbcc00641 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -370,6 +370,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 8fd3872cd8cbb0..947883c9d356e9 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 libcxx-commits mailing list