diff --git a/.github/workflows/build-debian.msan-based.yml b/.github/workflows/build-debian.msan-based.yml index ef0064e10..3de102d12 100644 --- a/.github/workflows/build-debian.msan-based.yml +++ b/.github/workflows/build-debian.msan-based.yml @@ -10,6 +10,7 @@ on: - 'ci_build_images/rr.Dockerfile' - 'ci_build_images/msan.fragment.Dockerfile' - 'ci_build_images/msan.instrumentedlibs.sh' + - 'ci_build_images/msan.motd' - 'ci_build_images/qpress.Dockerfile' - 'ci_build_images/buildbot-worker.Dockerfile' - .github/workflows/build-debian.msan-based.yml @@ -20,6 +21,7 @@ on: - 'ci_build_images/rr.Dockerfile' - 'ci_build_images/msan.fragment.Dockerfile' - 'ci_build_images/msan.instrumentedlibs.sh' + - 'ci_build_images/msan.motd' - 'ci_build_images/qpress.Dockerfile' - 'ci_build_images/buildbot-worker.Dockerfile' - .github/workflows/build-debian.msan-based.yml @@ -38,6 +40,18 @@ jobs: tag: debian12-msan-clang-20 clang_version: 20 nogalera: false + - image: debian:13 + platforms: linux/amd64 + branch: 11.4 + tag: debian13-msan-clang-21 + clang_version: 21 + nogalera: false + - image: debian:13 + platforms: linux/amd64 + branch: 11.8 + tag: debian13-msan-clang-22 + clang_version: 22 + nogalera: false uses: ./.github/workflows/bbw_build_container_template.yml with: @@ -48,8 +62,10 @@ jobs: branch: ${{ matrix.branch }} clang_version: ${{ matrix.clang_version }} nogalera: ${{ matrix.nogalera }} + runner: 'ubuntu-24.04' files: '[ - {"name": "msan.instrumentedlibs.sh", "source": "''$WORKDIR/msan.instrumentedlibs.sh''", "target": "''$GITHUB_WORKSPACE''"} + {"name": "msan.instrumentedlibs.sh", "source": "''$WORKDIR/msan.instrumentedlibs.sh''", "target": "''$GITHUB_WORKSPACE''"}, + {"name": "msan.motd", "source": "''$WORKDIR/msan.motd''", "target": "''$GITHUB_WORKSPACE''"} ]' secrets: inherit diff --git a/ci_build_images/msan.fragment.Dockerfile b/ci_build_images/msan.fragment.Dockerfile index c7b3c394a..fe5b2639c 100644 --- a/ci_build_images/msan.fragment.Dockerfile +++ b/ci_build_images/msan.fragment.Dockerfile @@ -9,7 +9,7 @@ ARG CLANG_VERSION=20 # This CLANG_DEV_VERSION is a marker to make it possible to build a msan builder # from the nightly clang versions as they are in a differently name repositories. # This maps to the https://apt.llvm.org/ under "development" branch version. -ENV CLANG_DEV_VERSION=21 +ENV CLANG_DEV_VERSION=22 WORKDIR /msan-build @@ -93,51 +93,10 @@ RUN . /etc/os-release \ COPY --from=rr /tmp/install/usr/ /usr/ # ASAN/UBSAN +COPY msan.motd /etc/motd + RUN echo "cat /etc/motd" > ~buildbot/.bashrc ; \ - printf "\ -This is a container for ASAN, UBSAN and MSAN building\n\ -\n\ -A basic MSAN build can be achieved with\n\ -\n\ -cmake -DWITH_EMBEDDED_SERVER=OFF \\ \n\ - -DWITH_INNODB_{BZIP2,LZ4,LZMA,LZO,SNAPPY}=OFF \\ \n\ - -DPLUGIN_{MROONGA,ROCKSDB,OQGRAPH,SPIDER}=NO \\ \n\ - -DWITH_ZLIB=bundled \\ \n\ - -DHAVE_LIBAIO_H=0 \\ \n\ - -DCMAKE_DISABLE_FIND_PACKAGE_{URING,LIBAIO}=1 \\ \n\ - -DWITH_NUMA=NO \\ \n\ - -DWITH_SYSTEMD=no \\ \n\ - -DWITH_MSAN=ON \\ \n\ - -DHAVE_CXX_NEW=1 \\ \n\ - -DCMAKE_{EXE,MODULE}_LINKER_FLAGS=\"-L\${MSAN_LIBDIR} -Wl,-rpath=\${MSAN_LIBDIR}\" \\ \n\ - -DWITH_DBUG_TRACE=OFF \\ \n\ - /source\n\ -\n\ -A basic combined UBSAN/ASAN build can be achieved with\n\ -\n\ -cmake -DWITH_ASAN=ON -DWITH_ASAN_SCOPED=ON -DWITH_UBSAN=ON -DPLUGIN_PERFSCHEMA=NO /source\n\ -\n\ -Build with:\n\ -\n\ -cmake --build .\n\ -\n\ -Test with:\n\ -\n\ -mysql-test/mtr --parallel=auto\n\ -\n\ -There are UBSAN filters covering currently unfixed bugs within\n\ -the server that can be used to direct your development, or validate if a\n\ -observed failure is known. Perform the following to download/inspect them.\n\ -\n\ -curl https://raw.githubusercontent.com/mariadb-corporation/mariadb-qa/refs/heads/master/UBSAN.filter -o /build/UBSAN.filter\n\ -\n\ -After this, add suppressions to UBSAN_OPTIONS with\n\ -\n\ -export UBSAN_OPTIONS=\$UBSAN_OPTIONS:suppressions=/build/UBSAN.filter\n\ -\n\ -ref sanitizer flags documents:\n\ -* https://github.com/google/sanitizers/wiki/AddressSanitizerFlags\n\ -* https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html\n\n" > /etc/motd + chown buildbot: ~buildbot/.bashrc ENV ASAN_OPTIONS=quarantine_size_mb=512:atexit=0:detect_invalid_pointer_pairs=3:dump_instruction_bytes=1:allocator_may_return_null=1 ENV UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1 diff --git a/ci_build_images/msan.instrumentedlibs.sh b/ci_build_images/msan.instrumentedlibs.sh index e6270eade..b9b95f9b4 100755 --- a/ci_build_images/msan.instrumentedlibs.sh +++ b/ci_build_images/msan.instrumentedlibs.sh @@ -65,7 +65,8 @@ rm -rf -- * apt-get source libidn2 mv libidn2-*/* . mk-build-deps -it 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' -./configure --enable-valgrind-tests=no +make -f debian/rules execute_before_dh_auto_configure +./configure --enable-valgrind-tests=no --enable-doc=no make -j "$(nproc)" cp -aL lib/.libs/libidn2.so* "$MSAN_LIBDIR" rm -rf -- * @@ -178,6 +179,13 @@ rm -rf -- * # shellcheck disable=SC2094 /usr/sbin/cracklib-packer /usr/share/dict/cracklib-small < /usr/share/dict/cracklib-small +# curl +apt-get source curl +mv curl*/* . +./configure --with-openssl --enable-ipv6 --disable-static --enable-websockets +make -j "$(nproc)" +mv ./lib/.libs/*.so* "$MSAN_LIBDIR" +rm -rf -- * # Now that we are built, clear out all the temporary build dependencies apt-get clean diff --git a/ci_build_images/msan.motd b/ci_build_images/msan.motd new file mode 100644 index 000000000..0de73ac2a --- /dev/null +++ b/ci_build_images/msan.motd @@ -0,0 +1,62 @@ +This is a container for ASAN, UBSAN and MSAN building. + +It can also be used as a basic build/test that contains rr. + +rr is available if the container is started with --privileged. + +The following assumed that /source is a mounted volume of the +MariaDB source code. + +A basic MSAN build can be configured with: + + cmake \ + -DWITH_MSAN=ON \ + -DCMAKE_{EXE,MODULE}_LINKER_FLAGS="-L${MSAN_LIBDIR} -Wl,-rpath=${MSAN_LIBDIR}" \ + -DUPDATE_SUBMODULES=OFF \ + -DPLUGIN_COLUMNSTORE=NO \ + -DWITH_UNIT_TESTS=OFF \ + -DWITH_ZLIB=bundled \ + -DWITH_SYSTEMD=no \ + -DWITH_DBUG_TRACE=OFF \ + /source + +A basic combined UBSAN/ASAN build can be configured with: + + cmake -DWITH_ASAN=ON -DWITH_ASAN_SCOPED=ON -DWITH_UBSAN=ON \ + -DUPDATE_SUBMODULES=OFF \ + -DPLUGIN_COLUMNSTORE=NO \ + -DWITH_UNIT_TESTS=OFF \ + /source + +Build with: + + cmake --build . + +Test with: + + mysql-test/mtr --parallel=auto + +Add --rr to record a specific MTR test. To replay: + + rr replay mysql-test/var/log/mysqld.1.rr/mariadb-0 + +There are UBSAN filters covering currently unfixed bugs within +the server that can be used to direct your development, or validate +if a observed failure is known. + +Perform the following to download/inspect them: + + curl https://raw.githubusercontent.com/mariadb-corporation/mariadb-qa/refs/heads/master/UBSAN.filter -o /build/UBSAN.filter + +After this, add suppressions to UBSAN_OPTIONS with + + export UBSAN_OPTIONS=$UBSAN_OPTIONS:suppressions=/build/UBSAN.filter + +To mark a function as unoptimized use the attribute: + + __attribute__((optnone)) + +ref sanitizer flags documents: +* https://github.com/google/sanitizers/wiki/AddressSanitizerFlags +* https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html +* https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/installing-mariadb/compiling-mariadb-from-source/compile-and-using-mariadb-with-sanitizers-asan-ubsan-tsan-msan#buildbots-msan-container