LLVM's Sanitizer documentation says:
Use clang++ to compile and link your program with -fsanitize=undefined flag. Make sure to use clang++ (not ld) as a linker, so that your executable is linked with proper UBSan runtime libraries. You can use clang instead of clang++ if you’re compiling/linking C code. ... You can enable only a subset of checks offered by UBSan, and define the desired behavior for each kind of check: ...
Does it mean that the subset of checks are by default included?
For example, is -fsanitize=undefined,alignment
redundant by having alignment
?
I have the same question about -fsanitize=address
and also about GCC sanitizer.
I would like to enable as much sanitizers simultaneously as possible but I don't want to have unnecessary options in the command line or CMake line.
That is, I don't want to have -fsanitize=address,pointer-compare,pointer-subtract,leak,shift,integer-divide-by-zero,unreachable,null,return,signed-integer-overflow
just in case.
How such command line look like?
The documentation is also not clear for the ASAN_OPTIONS
runtime variable, it is not clear if things need to be activated or not.
For example, I have ASAN_OPTIONS="handle_ioctl=true:check_initialization_order=true:detect_container_overflow=1:detect_stack_use_after_return=false:detect_odr_violation=1:allow_addr2line=true:strict_init_order=true"
but perhaps the on/true
options are not really necessary.