mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
68e6c2d768
MemorySanitizer is a compile-time instrumentation layer in clang and GCC. Together with AddressSanitizer mostly makes the run-time instrumentation of Valgrind redundant. It is a little more tricky to set up, because running with uninstrumented libraries will lead into false positives. You will need an instrumented libc++, and you should use -stdlib=libc++ instead of the default libstdc++. To build the instrumented library, you can refer to https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo or you can adapt these steps that worked for me, for clang-8 version 8.0.1: cd /mariadb sudo apt source libc++-8-dev cd llvm-toolchain-8-8.0.1 mkdir libc++msan; cd libc++msan cmake ../libcxx -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=Memory \ -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 Then, in your MariaDB build directory, you have to compile with libc++ and bundled libraries, such as WITH_SSL=bundled, WITH_ZLIB=bundled. For uninstrumented system libraries, you will get false positives for uninitialized values. Like this: cmake -DWITH_MSAN=ON -DWITH_SSL=bundled -DWITH_ZLIB=bundled \ -DCMAKE_CXX_FLAGS='-stdlib=libc++' .. Note: you should also add -O2 to the compiler options, or you may get crashes due to stack overflow. Finally, to run tests, you must replace libc++ with the instrumented one: LD_LIBRARY_PATH=/mariadb/llvm-toolchain-8-8.0.1/libc++msan/lib \ MSAN_OPTIONS=abort_on_error=1 \ ./mtr --big-test --parallel=auto --force --retry=0 Failure to do so will report numerous false positives related to operations on std::string and the like. This is work in progress. Some issues will still have to be fixed for WITH_MSAN to be usable. See MDEV-20377 for details. |
||
---|---|---|
.. | ||
build_configurations | ||
Internal/CPack | ||
os | ||
abi_check.cmake | ||
bison.cmake | ||
build_depends.cmake | ||
character_sets.cmake | ||
check_compiler_flag.cmake | ||
compile_flags.cmake | ||
configurable_file_content.in | ||
configure.pl | ||
cpack_deb.cmake | ||
cpack_rpm.cmake | ||
cpack_source_ignore_files.cmake | ||
cpu_info.cmake | ||
crc32-vpmsum.cmake | ||
create_initial_db.cmake.in | ||
ctest.cmake | ||
do_abi_check.cmake | ||
dtrace.cmake | ||
dtrace_prelink.cmake | ||
FindJava.cmake | ||
FindJNI.cmake | ||
FindLZ4.cmake | ||
FindZSTD.cmake | ||
for_clients.cmake | ||
info_bin.cmake | ||
info_macros.cmake.in | ||
info_src.cmake | ||
install_layout.cmake | ||
install_macros.cmake | ||
jemalloc.cmake | ||
libutils.cmake | ||
maintainer.cmake | ||
make_dist.cmake.in | ||
mariadb_connector_c.cmake | ||
merge_archives_unix.cmake.in | ||
misc.cmake | ||
mysql_add_executable.cmake | ||
mysql_version.cmake | ||
numa.cmake | ||
package_name.cmake | ||
pcre.cmake | ||
plugin.cmake | ||
readline.cmake | ||
sign.cmake.in | ||
ssl.cmake | ||
stack_direction.c | ||
submodules.cmake | ||
systemd.cmake | ||
tags.cmake | ||
versioninfo.rc.in | ||
win_compatibility.manifest | ||
wsrep.cmake | ||
zlib.cmake |