Sanitizer builds
- The DPS8M Development Team uses the several tools to help detect errors in the simulator.
- These builds are currently tested manually before releases due to lengthy run times and high memory consumption.
Notes
- Using Clang 14 or later is highly recommended for sanitizer builds; GCC is recommended for DUMA.
- Tests should be run on 64-bit Linux; not all sanitizers are supported on all platforms.
- Use of
faketime
with CI-Kit is overridden to prevent unwanted interactions.
-
gmake distclean
should be performed between each recompilation and when switching sanitizers.
- All examples tested successfully using Clang 14.0.5 on Fedora 36.
DUMA
-
DUMA detects and reports unintended memory accesses, leaks, and corruption.
- Other previously undetected runtime errors should crash at the erroneous line of code.
- See https://github.com/johnsonjh/duma for more information.
- Runtime overhead with DPS8M is approximately 1.1X (~10%).
- All fatal crashes MUST be corrected!
- All memory leaks SHOULD be investigated.
- Install DUMA
master
git clone "https://github.com/johnsonjh/duma.git" && cd duma && \
env CC="gcc" gmake test && \
sudo gmake install && sudo ldconfig && gmake installtest
- Build DUMA-enabled
dps8
and libuv
(export V=1 && \
export CC="gcc" && \
gmake distclean && \
env CFLAGS="-O1 -fno-inline -U_FORTIFY_SOURCE -ftrivial-auto-var-init=pattern -fno-stack-protector -fno-omit-frame-pointer -include /usr/include/string.h -include /usr/include/duma.h" && \
LDFLAGS="-l:libduma.a" && \
gmake libuvrel -j 8 && \
env CFLAGS="-fno-omit-frame-pointer" gmake DUMA=1 -j 8)
- Run CI-Kit
cd src/ci-kit && env FAKETIME="env TZ=UTC" NOREBUILD=1 ./ci.sh 2>&1 | stdbuf -o L tee duma.txt
- (Optional) Set
DUMA_PROTECT_BELOW=1
in the environment and repeat step 3.
Clang Ubsan
-
Ubsan checks for implementation-specific, platform-specific, unspecified, or undefined behaviors.
- Runtime overhead with DPS8M is approximately 2-3X.
- All detected errors (except integer overflow and negation warnings) MUST be corrected!
(export V=1 && \
export CC="clang" && \
export CFLAGS="-fsanitize=undefined,float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability -fno-omit-frame-pointer" && \
export LDFLAGS="-lubsan" && \
gmake distclean && gmake -j 8
) && cd src/ci-kit && env FAKETIME="env TZ=UTC" NOREBUILD=1 UBSAN_OPTIONS="print_stacktrace=1" ./ci.sh 2>&1 | stdbuf -o L tee ubsan.txt
Clang Asan+Lsan
-
Asan is a memory error detector (and includes Lsan, a memory leak detector.)
- Runtime overhead with DPS8M is approximately 4-5X.
- All detected memory errors MUST be corrected!
- All detected memory leaks SHOULD be investigated.
(export V=1 && \
export CC="clang" && \
export CFLAGS="-fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer" && \
export LDFLAGS="-fsanitize=address -fsanitize-address-use-after-scope" && \
gmake distclean && gmake -j 8
) && cd src/ci-kit && env FAKETIME="env TZ=UTC" NOREBUILD=1 ASAN_OPTIONS="check_initialization_order=1,detect_leaks=1" ./ci.sh 2>&1 | stdbuf -o L tee asan.txt
Clang Msan
-
Msan is an uninitialized read detector.
- Runtime overhead with DPS8M is approximately 5-6X.
- All detected errors MUST be corrected!
(export V=1 && \
export CC="clang" && \
export CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" && \
export LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" &&
gmake distclean && gmake libuvrel -j 8 && gmake -j 8
) && cd src/ci-kit && env FAKETIME="env TZ=UTC" NOREBUILD=1 ./ci.sh 2>&1 | stdbuf -o L tee msan.txt
Clang Tsan
-
Tsan is a race detector.
- Runtime overhead with DPS8M is approximately 15-20X.
- All detected races SHOULD be investigated.
(export V=1 && \
export CC="clang" && \
export CFLAGS="-fsanitize=thread -fno-omit-frame-pointer" && \
export LDFLAGS="-fsanitize=thread" && \
gmake distclean && gmake libuvrel -j 8 && gmake -j 8
) && cd src/ci-kit && env FAKETIME="env TZ=UTC" NOREBUILD=1 ./ci.sh 2>&1 | stdbuf -o L tee tsan.txt