Summary: | Does FreeBSD 12.2-RELEASE amd64 support -fsanitize=leak? | ||
---|---|---|---|
Product: | Base System | Reporter: | ota |
Component: | bin | Assignee: | freebsd-toolchain (Nobody) <toolchain> |
Status: | Closed Not A Bug | ||
Severity: | Affects Only Me | CC: | dim, lwhsu, pjfloyd |
Priority: | --- | ||
Version: | 12.2-RELEASE | ||
Hardware: | amd64 | ||
OS: | Any |
Description
ota
2021-06-10 06:23:34 UTC
Even though the code in contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp appears to imply that LeakSanitizer is supported, the required libraries in compiler-rt do not. E.g. contrib/llvm-project/compiler-rt/lib/lsan/lsan_common.h has: // LeakSanitizer relies on some Glibc's internals (e.g. TLS machinery) on Linux. // Also, LSan doesn't like 32 bit architectures // because of "small" (4 bytes) pointer size that leads to high false negative // ratio on large leaks. But we still want to have it for some 32 bit arches // (e.g. x86), see https://github.com/google/sanitizers/issues/403. // To enable LeakSanitizer on a new architecture, one needs to implement the // internal_clone function as well as (probably) adjust the TLS machinery for // the new architecture inside the sanitizer library. #if (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) && \ (SANITIZER_WORDSIZE == 64) && \ (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ defined(__powerpc64__)) #define CAN_SANITIZE_LEAKS 1 #elif defined(__i386__) && \ (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) #define CAN_SANITIZE_LEAKS 1 #elif defined(__arm__) && \ SANITIZER_LINUX && !SANITIZER_ANDROID #define CAN_SANITIZE_LEAKS 1 #elif SANITIZER_NETBSD #define CAN_SANITIZE_LEAKS 1 #else #define CAN_SANITIZE_LEAKS 0 #endif Somebody needs to step up and implement the required bits upstream, then we can import it into FreeBSD. But for now, we don't have LeakSanitizer. Note also that you should be able to use Valgrind memcheck for this as an alternative. Thanks for clarification. |