Tune mmap_rnd_bits to workaround sanitizers issues

v1: vm.mmap_rnd_bits=28
v2: rebase with clang 18.1.6 + kernel.randomize_va_space=0
v3: leave only vm.mmap_rnd_bits=28 + use pre-run.sh (hope that it will
    be used), that way docker will not require --privileged and by some
    reason this breaks ASAN (though I cannot reproduce it)
v4: use actions/common_setup over init_runner.sh (it requires some
    manual deploy)
This commit is contained in:
Azat Khuzhin 2024-05-18 12:54:23 +02:00
parent c940928bb5
commit 64a308013f
2 changed files with 9 additions and 0 deletions

View File

@ -28,3 +28,10 @@ runs:
run: | run: |
# to remove every leftovers # to remove every leftovers
sudo rm -fr "$TEMP_PATH" && mkdir -p "$TEMP_PATH" sudo rm -fr "$TEMP_PATH" && mkdir -p "$TEMP_PATH"
- name: Tune vm.mmap_rnd_bits for sanitizers
shell: bash
run: |
sudo sysctl vm.mmap_rnd_bits
# https://github.com/google/sanitizers/issues/856
echo "Tune vm.mmap_rnd_bits for sanitizers"
sudo sysctl vm.mmap_rnd_bits=28

View File

@ -91,6 +91,8 @@ apt-get install --yes --no-install-recommends azure-cli
# Increase the limit on number of virtual memory mappings to aviod 'Cannot mmap' error # Increase the limit on number of virtual memory mappings to aviod 'Cannot mmap' error
echo "vm.max_map_count = 2097152" > /etc/sysctl.d/01-increase-map-counts.conf echo "vm.max_map_count = 2097152" > /etc/sysctl.d/01-increase-map-counts.conf
# Workarond for sanitizers uncompatibility with some kernels, see https://github.com/google/sanitizers/issues/856
echo "vm.mmap_rnd_bits=28" > /etc/sysctl.d/02-vm-mmap_rnd_bits.conf
systemctl restart docker systemctl restart docker