[Bug 256524] Does FreeBSD 12.2-RELEASE amd64 support -fsanitize=leak?

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 10 Jun 2021 17:07:01 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256524

Dimitry Andric <dim_at_FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Closed
                 CC|                            |dim_at_FreeBSD.org
         Resolution|---                         |Not A Bug

--- Comment #1 from Dimitry Andric <dim_at_FreeBSD.org> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Thu Jun 10 2021 - 17:07:01 UTC

Original text of this message