gitlab: fix failing TSAN job in CI
cover gitlab: fix failing TSAN job in CI
See patch 3 commit message for the key details about the problem.
Daniel P. Berrangé (3):
dockerfiles: add 'MAKE' env variable to remaining containers
gitlab: use $MAKE instead of 'make'
gitlab: use 'setarch -R' to workaround tsan bug
.gitlab-ci.d/buildtest-template.yml | 6 +++--- .gitlab-ci.d/buildtest.yml | 3 +++ tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/docker/dockerfiles/debian-hexagon-cross.docker | 1 + tests/docker/dockerfiles/debian-legacy-test-cross.docker | 1 + tests/docker/dockerfiles/debian-loongarch-cross.docker | 1 + tests/docker/dockerfiles/debian-tricore-cross.docker | 1 + tests/docker/dockerfiles/debian-xtensa-cross.docker | 1 + tests/docker/dockerfiles/fedora-cris-cross.docker | 1 + 9 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 dockerfiles: add 'MAKE' env variable to remaining containers
All the lcitool generated containers define a "MAKE" env. It will be convenient for later patches if all containers do this.
--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/docker/dockerfiles/debian-hexagon-cross.docker | 1 + tests/docker/dockerfiles/debian-legacy-test-cross.docker | 1 + tests/docker/dockerfiles/debian-loongarch-cross.docker | 1 + tests/docker/dockerfiles/debian-tricore-cross.docker | 1 + tests/docker/dockerfiles/debian-xtensa-cross.docker | 1 + tests/docker/dockerfiles/fedora-cris-cross.docker | 1 + 7 files changed, 7 insertions(+)
tests/docker/dockerfiles/debian-all-test-cross.docker +1 -0
@@ -68,6 +68,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools ENV DEF_TARGET_LIST aarch64-linux-user,arm-linux-user,hppa-linux-user,i386-linux-user,m68k-linux-user,mips-linux-user,mips64-linux-user,mips64el-linux-user,mipsel-linux-user,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,riscv64-linux-user,s390x-linux-user,sparc64-linux-user # As a final step configure the user (if env is defined) +ENV MAKE /usr/bin/make ARG USER ARG UID RUN if [ "${USER}" ]; then \
tests/docker/dockerfiles/debian-hexagon-cross.docker +1 -0
@@ -45,6 +45,7 @@ ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL" ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu/bin +ENV MAKE /usr/bin/make # As a final step configure the user (if env is defined) ARG USER ARG UID
tests/docker/dockerfiles/debian-legacy-test-cross.docker +1 -0
@@ -42,6 +42,7 @@ RUN /usr/bin/pip3 install tomli ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools ENV DEF_TARGET_LIST alpha-linux-user,sh4-linux-user +ENV MAKE /usr/bin/make # As a final step configure the user (if env is defined) ARG USER ARG UID
tests/docker/dockerfiles/debian-loongarch-cross.docker +1 -0
@@ -44,6 +44,7 @@ ENV LD_LIBRARY_PATH /opt/cross-tools/lib:/opt/cross-tools/loongarch64-unknown-li ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools ENV DEF_TARGET_LIST loongarch64-linux-user,loongarch-softmmu +ENV MAKE /usr/bin/make # As a final step configure the user (if env is defined) ARG USER
tests/docker/dockerfiles/debian-tricore-cross.docker +1 -0
@@ -44,6 +44,7 @@ RUN curl -#SL https://github.com/bkoppelmann/package_940/releases/download/trico # This image can only build a very minimal QEMU as well as the tests ENV DEF_TARGET_LIST tricore-softmmu ENV QEMU_CONFIGURE_OPTS --disable-user --disable-tools --disable-fdt +ENV MAKE /usr/bin/make # As a final step configure the user (if env is defined) ARG USER ARG UID
tests/docker/dockerfiles/debian-xtensa-cross.docker +1 -0
@@ -27,6 +27,7 @@ RUN for cpu in $CPU_LIST; do \ done ENV PATH $PATH:/opt/$TOOLCHAIN_RELEASE/xtensa-dc232b-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dc233c-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-de233_fpu-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dsp3400-elf/bin +ENV MAKE /usr/bin/make # As a final step configure the user (if env is defined) ARG USER ARG UID
tests/docker/dockerfiles/fedora-cris-cross.docker +1 -0
@@ -4,6 +4,7 @@ FROM registry.fedoraproject.org/fedora:33 ENV PACKAGES gcc-cris-linux-gnu +ENV MAKE /usr/bin/make RUN dnf install -y $PACKAGES RUN rpm -q $PACKAGES | sort > /packages.txt # As a final step configure the user (if env is defined)
Signature · 1 line
2.43.0
Re: [PATCH 1/3] dockerfiles: add 'MAKE' env variable to remaining containers
Quoted 4 lines · Daniel P. Berrangé
All the lcitool generated containers define a "MAKE" env. It will be convenient for later patches if all containers do this.
Signed-off-by Daniel P. Berrangé <[email protected]>
Quoted 9 lines
--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/docker/dockerfiles/debian-hexagon-cross.docker | 1 + tests/docker/dockerfiles/debian-legacy-test-cross.docker | 1 + tests/docker/dockerfiles/debian-loongarch-cross.docker | 1 + tests/docker/dockerfiles/debian-tricore-cross.docker | 1 + tests/docker/dockerfiles/debian-xtensa-cross.docker | 1 + tests/docker/dockerfiles/fedora-cris-cross.docker | 1 + 7 files changed, 7 insertions(+)
Re: [PATCH 1/3] dockerfiles: add 'MAKE' env variable to remaining containers
In reply to Daniel P. BerrangéQuoted 4 lines · Daniel P. Berrangé
All the lcitool generated containers define a "MAKE" env. It will be convenient for later patches if all containers do this.
Signed-off-by Daniel P. Berrangé <[email protected]>
Quoted 9 lines
--- tests/docker/dockerfiles/debian-all-test-cross.docker | 1 + tests/docker/dockerfiles/debian-hexagon-cross.docker | 1 + tests/docker/dockerfiles/debian-legacy-test-cross.docker | 1 + tests/docker/dockerfiles/debian-loongarch-cross.docker | 1 + tests/docker/dockerfiles/debian-tricore-cross.docker | 1 + tests/docker/dockerfiles/debian-xtensa-cross.docker | 1 + tests/docker/dockerfiles/fedora-cris-cross.docker | 1 + 7 files changed, 7 insertions(+)
PATCH 2/3 gitlab: use $MAKE instead of 'make'
In reply to Daniel P. BerrangéThe lcitool generated containers have '$MAKE' set to the path of the right 'make' binary. Using the env variable makes it possible to override the choice per job.
--- .gitlab-ci.d/buildtest-template.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
.gitlab-ci.d/buildtest-template.yml +3 -3
@@ -26,10 +26,10 @@ then pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ; fi || exit 1; - - make -j"$JOBS" + - $MAKE -j"$JOBS" - if test -n "$MAKE_CHECK_ARGS"; then - make -j"$JOBS" $MAKE_CHECK_ARGS ; + $MAKE -j"$JOBS" $MAKE_CHECK_ARGS ; fi - ccache --show-stats
@@ -60,7 +60,7 @@ - cd build - find . -type f -exec touch {} + # Avoid recompiling by hiding ninja with NINJA=":" - - make NINJA=":" $MAKE_CHECK_ARGS + - $MAKE NINJA=":" $MAKE_CHECK_ARGS .native_test_job_template: extends: .common_test_job_template
Signature · 1 line
2.43.0
Re: [PATCH 2/3] gitlab: use $MAKE instead of 'make'
Quoted 8 lines · Daniel P. Berrangé
The lcitool generated containers have '$MAKE' set to the path of the right 'make' binary. Using the env variable makes it possible to override the choice per job.
Signed-off-by Daniel P. Berrangé <[email protected]>--- .gitlab-ci.d/buildtest-template.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Re: [PATCH 2/3] gitlab: use $MAKE instead of 'make'
In reply to Daniel P. BerrangéQuoted 8 lines · Daniel P. Berrangé
The lcitool generated containers have '$MAKE' set to the path of the right 'make' binary. Using the env variable makes it possible to override the choice per job.
Signed-off-by Daniel P. Berrangé <[email protected]>--- .gitlab-ci.d/buildtest-template.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
PATCH 3/3 gitlab: use 'setarch -R' to workaround tsan bug
In reply to Daniel P. BerrangéThe TSAN job started failing when gitlab rolled out their latest release. The root cause is a change in the Google COS version used on shared runners. This brings a kernel running with
vm.mmap_rnd_bits = 31
which is incompatible with TSAN in LLVM < 18, which only supports upto '28'. LLVM 18 can support upto '30', and failing that will re-exec itself to turn off VA randomization.
Our LLVM is too old for now, but we can run with 'setarch -R make ..' to turn off VA randomization ourselves.
--- .gitlab-ci.d/buildtest.yml | 3 +++ 1 file changed, 3 insertions(+)
.gitlab-ci.d/buildtest.yml +3 -0
@@ -575,6 +575,9 @@ tsan-build: CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++ --enable-trace-backends=ust --disable-slirp TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user + # Remove when we switch to a distro with clang >= 18 + # https://github.com/google/sanitizers/issues/1716 + MAKE: setarch -R make # gcov is a GCC features gcov:
Signature · 1 line
2.43.0
Re: [PATCH 3/3] gitlab: use 'setarch -R' to workaround tsan bug
Quoted 23 lines · Daniel P. Berrangé
The TSAN job started failing when gitlab rolled out their latest release. The root cause is a change in the Google COS version used on shared runners. This brings a kernel running with
vm.mmap_rnd_bits = 31
which is incompatible with TSAN in LLVM < 18, which only supports upto '28'. LLVM 18 can support upto '30', and failing that will re-exec itself to turn off VA randomization.
Our LLVM is too old for now, but we can run with 'setarch -R make ..' to turn off VA randomization ourselves.
Signed-off-by Daniel P. Berrangé <[email protected]>--- .gitlab-ci.d/buildtest.yml | 3 +++ 1 file changed, 3 insertions(+).gitlab-ci.d/buildtest.yml +0
-0
.gitlab-ci.d/buildtest.yml tsan-build: · line 580
Quoted 6 lines
.gitlab-ci.d/buildtest.yml +3
-0@@ -575,6 +575,9 @@ tsan-build: CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++ --enable-trace-backends=ust --disable-slirp TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user + # Remove when we switch to a distro with clang >= 18 + # https://github.com/google/sanitizers/issues/1716 + MAKE: setarch -R make
Thanks for tackling this!
Re: [PATCH 3/3] gitlab: use 'setarch -R' to workaround tsan bug
In reply to Daniel P. BerrangéQuoted 10 lines · Daniel P. Berrangé
The TSAN job started failing when gitlab rolled out their latest release. The root cause is a change in the Google COS version used on shared runners. This brings a kernel running with
vm.mmap_rnd_bits = 31
which is incompatible with TSAN in LLVM < 18, which only supports upto '28'. LLVM 18 can support upto '30', and failing that will re-exec itself to turn off VA randomization.
Quoted 7 lines
Our LLVM is too old for now, but we can run with 'setarch -R make ..' to turn off VA randomization ourselves.
Signed-off-by Daniel P. Berrangé <[email protected]>--- .gitlab-ci.d/buildtest.yml | 3 +++ 1 file changed, 3 insertions(+)
Example job showing this working:
https://gitlab.com/berrange/qemu/-/jobs/6824465594
Quoted 18 lines
.gitlab-ci.d/buildtest.yml +3
-0@@ -575,6 +575,9 @@ tsan-build: CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++ --enable-trace-backends=ust --disable-slirp TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user + # Remove when we switch to a distro with clang >= 18 + # https://github.com/google/sanitizers/issues/1716 + MAKE: setarch -R make # gcov is a GCC features gcov:Signature · 1 line
2.43.0
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|