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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 13:08:28 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/124837.diff


4 Files Affected:

- (modified) .github/workflows/libcxx-build-and-test.yaml (+2) 
- (added) libcxx/cmake/caches/Generic-cfisan.cmake (+1) 
- (modified) libcxx/utils/ci/run-buildbot (+5) 
- (modified) libcxx/utils/libcxx/test/params.py (+4) 


``````````diff
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,

``````````

</details>


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


More information about the llvm-commits mailing list