ASan and UBSan

QNX SDP8.0QNX OS System Security GuideAPIConfiguration

The compiler builds the ASan and UBSan features into the executables. An environment variable optionally controls these features.

ASan

Address Sanitizer (ASan) is a memory error detector for C/C++.

When you enable the ASan feature, the compiler adds code to the program to implement address sanitization. You can then build the binary with the -fsanitize=address option (refer to Recommended compiler verification options). The program relies on the libasan.so library, which links automatically, for the target-dependent functionality.

Note:
The target runtime part of the GCC sanitizer suite (libasan) is a compiler feature. It sanitizes the code at build and run time.

The ASAN_OPTIONS environment variable passes most of the runtime flags to the Address Sanitizer. For more information on runtime and other flags, refer to the AddressSanitizer project documentation at: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags.

UBSan

Undefined Behavior Sanitizer (UBSan) is a fast, undefined-behavior detector.

UBSan modifies the program at compile time to catch undefined behavior during the execution of a program. For details about current checks, refer to the Clang Compiler documentation for UBSan at: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#ubsan-checks.

To suppress the UBSan error reports for specific files, functions, or libraries, without recompiling the code, pass its path in a UBSAN_OPTIONS environment variable.

When you use the qcc option to compile and link the program with the -fsanitize=undefined flag, the executable links with the proper UBSan runtime library (libubsan.so).

Page updated: