From e91c0d3b645806f3fca7d72050bca0931010c869 Mon Sep 17 00:00:00 2001 From: Louis Dionne 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 ee77e83363d37..4544e82e3043d 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 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 f1ede6474eb9e..8a2a2fbcc0064 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 8fd3872cd8cbb..947883c9d356e 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,