From bcc05cc00ea8fec0f5bb0f1d55f3327c4408cfca Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Thu, 14 Mar 2024 12:14:11 +0100 Subject: [PATCH] Fix the address and thread sanitizer builds on newer kernels (#1304) Recent versions of the linux kernel and also recent versions of the Ubuntu distributions have increased the number of bits that are used for virtual address layout randomization. The sanitizer tools have to be aware of this randomization but have not yet picked up that change. Our current fix is to manually reduce the number of randomization bits back to 28 (the previous value) for our GitHub actions builds. --- .github/workflows/native-build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml index 881dab1575..0590d4d0f5 100644 --- a/.github/workflows/native-build.yml +++ b/.github/workflows/native-build.yml @@ -67,6 +67,12 @@ jobs: with: compiler: ${{matrix.compiler}} compiler-version: ${{matrix.compiler-version}} + - name: Reduce address randomization to make sanitizers work + # For details see for example `https://stackoverflow.com/questions/77850769/fatal-threadsanitizer-unexpected-memory-mapping-when-running-on-linux-kernels` + run: | + sudo sysctl vm.mmap_rnd_bits + sudo sysctl vm.mmap_rnd_bits=28 + - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.