From 639cae9b6d7cb45176d3dc08571146c5599078d1 Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Tue, 19 Mar 2024 21:14:05 +0100 Subject: [PATCH] Tune address space layout randomization when running thread/address sanitizer --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c2bcd3154..44d22e5882 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,14 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + # ASLR (https://en.wikipedia.org/wiki/Address_space_layout_randomization) + # causes thread sanitizer to fail. + # vm.mmap_rnd_bits needs to be set to 28 to make it work. + # (https://github.com/google/sanitizers/issues/1716) + - run: sysctl vm.legacy_va_layout + - run: sysctl kernel.randomize_va_space + - run: sudo sysctl vm.mmap_rnd_bits + - run: sudo sysctl -w vm.mmap_rnd_bits=28 - run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server - run: ./configure --everything --no-samples --omit=PDF && make all -s -j4 SANITIZEFLAGS=-fsanitize=address && sudo make install - uses: ./.github/actions/retry-action @@ -103,6 +111,14 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + # ASLR (https://en.wikipedia.org/wiki/Address_space_layout_randomization) + # causes thread sanitizer to fail. + # vm.mmap_rnd_bits needs to be set to 28 to make it work. + # (https://github.com/google/sanitizers/issues/1716) + - run: sysctl vm.legacy_va_layout + - run: sysctl kernel.randomize_va_space + - run: sudo sysctl vm.mmap_rnd_bits + - run: sudo sysctl -w vm.mmap_rnd_bits=28 - run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server - run: ./configure --everything --no-samples --omit=PDF --no-soo && make all -s -j4 SANITIZEFLAGS=-fsanitize=address && sudo make install - uses: ./.github/actions/retry-action @@ -135,6 +151,14 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + # ASLR (https://en.wikipedia.org/wiki/Address_space_layout_randomization) + # causes thread sanitizer to fail. + # vm.mmap_rnd_bits needs to be set to 28 to make it work. + # (https://github.com/google/sanitizers/issues/1716) + - run: sysctl vm.legacy_va_layout + - run: sysctl kernel.randomize_va_space + - run: sudo sysctl vm.mmap_rnd_bits + - run: sudo sysctl -w vm.mmap_rnd_bits=28 - run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev redis-server - run: ./configure --everything --no-samples --omit=CppParser,Encodings,Data/MySQL,Data/ODBC,Data/PostgreSQL,MongoDB,PageCompiler,PDF,PocoDoc,ProGen,Redis,SevenZip && make all -s -j4 SANITIZEFLAGS=-fsanitize=thread && sudo make install - uses: ./.github/actions/retry-action @@ -143,8 +167,7 @@ jobs: max_attempts: 3 retry_on: any command: >- - sudo -s - ./ci/runtests.sh TSAN + sudo -s ./ci/runtests.sh TSAN linux-gcc-cmake: runs-on: ubuntu-22.04