Skip to content

Commit 0d6af0f

Browse files
enkiuszarkqbzbarsky-apple
authored
docker: Document workaround for TSAN failures when running under a post 6.6.6 Linux kernel (project-chip#39885)
* docker: Document workaround for TSAN failures when running under a post 6.6.6 Linux kernel * docker: Bail out early on meson error * docker: Fix typo * Update integrations/docker/images/base/chip-build/Dockerfile * Update integrations/docker/images/base/chip-build/Dockerfile --------- Signed-off-by: Maciej Grela <[email protected]> Co-authored-by: Arkadiusz Bokowy <[email protected]> Co-authored-by: Boris Zbarsky <[email protected]>
1 parent 2346319 commit 0d6af0f

File tree

1 file changed

+16
-1
lines changed
  • integrations/docker/images/base/chip-build

1 file changed

+16
-1
lines changed

integrations/docker/images/base/chip-build/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ RUN set -x \
150150
&& rm -rf bloaty \
151151
&& : # last line
152152

153+
# Code built with thread sanitizer can sometimes fail to run with an error message
154+
# similar to the following:
155+
# FATAL: ThreadSanitizer: unexpected memory mapping 0x7763c5472000-0x7763c5900000
156+
#
157+
# This happens for example when the build is executed on a Ubuntu 24.04 host. It
158+
# is reported to be linked with kernel versions 6.6.6 and higher. In order for the
159+
# build to succeed ASLR entropy needs to be reduced. This can be done with the
160+
# sysctl command:
161+
# sudo sysctl vm.mmap_rnd_bits=28
162+
#
163+
# This command is not persistent across reboots. This is desired as reducing
164+
# ASLR entropy has negative impact on exploit mitigation.
165+
# Reference: https://github.com/google/sanitizers/issues/1716
166+
153167
# Build glib-2.0 from source with enabled thread sanitizer. This is needed for
154168
# running CHIP tests with TSAN enabled. When running applications with TSAN
155169
# all shared libraries should be built with TSAN enabled, otherwise TSAN might
@@ -163,7 +177,8 @@ RUN case ${TARGETPLATFORM} in \
163177
&& export CCACHE_DISABLE=1 PYTHONDONTWRITEBYTECODE=1 \
164178
&& GLIB_VERSION=$(pkg-config --modversion glib-2.0) \
165179
&& git clone --depth=1 --branch=$GLIB_VERSION https://github.com/GNOME/glib.git \
166-
&& CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib -Dtests=false \
180+
&& (CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib -Dtests=false || \
181+
{ cat glib/build/meson-logs/meson-log.txt; exit 1; }) \
167182
&& DESTDIR=../build-image ninja -C glib/build install \
168183
&& mv glib/build-image/usr/local/lib64/lib* $LD_LIBRARY_PATH_TSAN \
169184
&& rm -rf glib \

0 commit comments

Comments
 (0)