Browse Source

package/ci: run the TSan job on a VM to have control over ASLR.

pull/651/merge
Vladimír Vondruš 1 year ago
parent
commit
9f3856d797
  1. 83
      package/ci/circleci.yml

83
package/ci/circleci.yml

@ -15,6 +15,11 @@ executors:
ubuntu-18_04: ubuntu-18_04:
docker: docker:
- image: ubuntu:bionic-20220427 - image: ubuntu:bionic-20220427
# Used by the ThreadSanitizer build. Cannot be a Docker because we need to
# disable ASLR which can only be done with a real VM.
ubuntu-20_04:
machine:
image: ubuntu-2004:2024.11.1
# Anything below 13.4.1 (and all x86 variants) are deprecated as of June 28th # Anything below 13.4.1 (and all x86 variants) are deprecated as of June 28th
# 2024 # 2024
xcode-13_4: xcode-13_4:
@ -138,30 +143,41 @@ commands:
# embedded toolchains still use it, for Clang we just pick the version # embedded toolchains still use it, for Clang we just pick the version
# available in the oldest supported distro. # available in the oldest supported distro.
install-clang: install-clang:
parameters:
sudo:
type: string
default: ""
symbolizer-link:
type: boolean
default: true
steps: steps:
- run: - run:
# For some reason, CMake needs a working C compiler, so provice CC as # For some reason, CMake needs a working C compiler, so provide CC as
# well for the case when default gcc isn't installed. # well for the case when default gcc isn't installed.
#
# The llvm-symbolizer link needs to be set in order to have usable
# symbols in the output. This affects suppressions as well, meaning
# they won't work if the symbols are not resolvable. It's not enough to
# just `export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-6.0`
# because it then complains that
#
# External symbolizer path is set to '/usr/bin/llvm-symbolizer-6.0'
# which isn't a known symbolizer. Please set the path to the
# llvm-symbolizer binary or other known tool.
#
# Probably because because it detects tool type based on the filename?
# Ugh.
name: Install Clang name: Install Clang
command: | command: |
apt install -y clang << parameters.sudo >> apt install -y clang
echo 'export CC=clang' >> $BASH_ENV echo 'export CC=clang' >> $BASH_ENV
echo 'export CXX=clang++' >> $BASH_ENV echo 'export CXX=clang++' >> $BASH_ENV
ls -l /usr/bin/llvm-symbolizer-6.0 # With Clang 6 on 18.04, the llvm-symbolizer link needs to be set in order
ln -s /usr/bin/llvm-symbolizer{-6.0,} # to have usable symbols in the output. This affects suppressions as well,
# meaning they won't work if the symbols are not resolvable. It's not
# enough to just `export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-6.0`
# because it then complains that
#
# External symbolizer path is set to '/usr/bin/llvm-symbolizer-6.0' which
# isn't a known symbolizer. Please set the path to the llvm-symbolizer
# binary or other known tool.
#
# Probably because because it detects tool type based on the filename? Ugh.
- when:
condition: << parameters.symbolizer-link >>
steps:
- run:
name: Create /usr/bin/llvm-symbolizer symlink
command: |
ls -l /usr/bin/llvm-symbolizer-6.0
ln -s /usr/bin/llvm-symbolizer{-6.0,}
install-nodejs: install-nodejs:
parameters: parameters:
@ -550,8 +566,21 @@ jobs:
- build: - build:
script: unix-desktop.sh script: unix-desktop.sh
# https://github.com/google/sanitizers/issues/1716 ; started happening on
# 2024-11-08 as CircleCI uses a base system with kernel 6.5 instead of 5.15
# for Docker images:
# https://discuss.circleci.com/t/docker-executor-infrastructure-upgrade/52282
# This manifests when running corrade-rc already:
# ThreadSanitizer: unexpected memory mapping 0x7e2f226ae000-0x7e2f22b00000
# Unfortunately, with Docker images, none of the suggested
# sysctl vm.mmap_rnd_bits=28
# echo 0 | tee /proc/sys/kernel/randomize_va_space
# works, complaining about read-only filesystem. The only way to set those is
# with a real VM instead of Docker, which is what's done here. It also means
# it's not possible to test on 18.04 anymore as those VMs are no longer
# provided.
linux-threadsanitizer: linux-threadsanitizer:
executor: ubuntu-18_04 executor: ubuntu-20_04
environment: environment:
# STUPID yml interprets unquoted OFF as a boolean. Applications don't # STUPID yml interprets unquoted OFF as a boolean. Applications don't
# have any automated tests, so building them for sanitizers doesn't make # have any automated tests, so building them for sanitizers doesn't make
@ -567,14 +596,22 @@ jobs:
-DMAGNUM_WITH_GLXCONTEXT=ON -DMAGNUM_WITH_GLXCONTEXT=ON
-DMAGNUM_WITH_EGLCONTEXT=ON -DMAGNUM_WITH_EGLCONTEXT=ON
steps: steps:
# libidn11 needed by CMake
- install-base-linux: - install-base-linux:
extra: libidn11 libgl1-mesa-dev libegl1-mesa-dev libopenal-dev libvulkan-dev extra: cmake libgl1-mesa-dev libegl1-mesa-dev libopenal-dev libvulkan-dev
sudo: sudo
- cap-ninja-jobs - cap-ninja-jobs
- install-clang - install-clang:
- install-cmake: sudo: sudo
version: "3.5.2" symbolizer-link: false
- setup-null-openal-driver - setup-null-openal-driver
- run:
# Right now (2025-01-17) it's already set to 28 so nothing needs to be
# changed. This is for the future when it may break again, and yes,
# setting it explicitly to 32 causes the above error again.
name: Ensure ASLR is compatible with ThreadSanitizer
command: |
sudo sysctl vm.mmap_rnd_bits
sudo sysctl vm.mmap_rnd_bits=28
- build: - build:
script: unix-desktop.sh script: unix-desktop.sh

Loading…
Cancel
Save