1name: Sanitizer checks 2 3on: 4 pull_request: 5 paths: 6 - '**' 7 - '!docs/**' 8 - '!.**' 9 - '.github/workflows/sanitizer.yml' 10 push: 11 branches: 12 - v[0-9].* 13 - master 14 15jobs: 16 sanitizers-linux: 17 runs-on: ubuntu-22.04 18 steps: 19 - uses: actions/checkout@v4 20 - name: Setup 21 run: | 22 sudo apt-get install ninja-build 23 - name: Envinfo 24 run: npx envinfo 25 26 # [AM]SAN fail on newer kernels due to a bigger PIE slide 27 - name: Disable ASLR 28 run: | 29 sudo sysctl -w kernel.randomize_va_space=0 30 31 - name: ASAN Build 32 run: | 33 mkdir build-asan 34 (cd build-asan && cmake .. -G Ninja -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug) 35 cmake --build build-asan 36 - name: ASAN Test 37 run: | 38 ./build-asan/uv_run_tests_a 39 40 - name: MSAN Build 41 run: | 42 mkdir build-msan 43 (cd build-msan && cmake .. -G Ninja -DBUILD_TESTING=ON -DMSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang) 44 cmake --build build-msan 45 - name: MSAN Test 46 run: | 47 ./build-msan/uv_run_tests_a 48 49 - name: TSAN Build 50 run: | 51 mkdir build-tsan 52 (cd build-tsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release) 53 cmake --build build-tsan 54 - name: TSAN Test 55 # Note: path must be absolute because some tests chdir. 56 # TSan exits with an error when it can't find the file. 57 run: | 58 env TSAN_OPTIONS="suppressions=$PWD/tsansupp.txt" ./build-tsan/uv_run_tests_a 59 60 - name: UBSAN Build 61 run: | 62 mkdir build-ubsan 63 (cd build-ubsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang) 64 cmake --build build-ubsan 65 - name: UBSAN Test 66 run: | 67 ./build-ubsan/uv_run_tests_a 68 69 sanitizers-macos: 70 runs-on: macos-13 71 steps: 72 - uses: actions/checkout@v4 73 74 - name: Envinfo 75 run: npx envinfo 76 77 - name: ASAN Build 78 run: | 79 mkdir build-asan 80 (cd build-asan && cmake .. -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug) 81 cmake --build build-asan 82 - name: ASAN Test 83 run: | 84 ./build-asan/uv_run_tests_a 85 86 - name: TSAN Build 87 run: | 88 mkdir build-tsan 89 (cd build-tsan && cmake .. -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release) 90 cmake --build build-tsan 91 - name: TSAN Test 92 run: | 93 ./build-tsan/uv_run_tests_a 94 95 - name: UBSAN Build 96 run: | 97 mkdir build-ubsan 98 (cd build-ubsan && cmake .. -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug) 99 cmake --build build-ubsan 100 - name: UBSAN Test 101 run: | 102 ./build-ubsan/uv_run_tests_a 103 104 sanitizers-windows: 105 runs-on: windows-2022 106 steps: 107 - uses: actions/checkout@v4 108 - name: Setup 109 run: | 110 choco install ninja 111 112 # Note: clang shipped with VS2022 has an issue where the UBSAN runtime doesn't link. 113 - name: Install LLVM and Clang 114 uses: KyleMayes/install-llvm-action@v2 115 with: 116 version: "17" 117 118 - name: Envinfo 119 run: npx envinfo 120 121 - name: UBSAN Build 122 run: | 123 mkdir build-ubsan 124 cmake -B build-ubsan -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang 125 cmake --build build-ubsan 126 - name: UBSAN Test 127 run: | 128 ./build-ubsan/uv_run_tests_a 129