Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2021 17:07:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 256524] Does FreeBSD 12.2-RELEASE amd64 support -fsanitize=leak?
Message-ID:  <bug-256524-29464-tjTBi1Cwcw@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-256524-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-256524-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D256524

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Closed
                 CC|                            |dim@FreeBSD.org
         Resolution|---                         |Not A Bug

--- Comment #1 from Dimitry Andric <dim@FreeBSD.org> ---
Even though the code in
contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp appears to imp=
ly
that LeakSanitizer is supported, the required libraries in compiler-rt do n=
ot.

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 negat=
ive
// 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 f=
or
// the new architecture inside the sanitizer library.
#if (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) && \
    (SANITIZER_WORDSIZE =3D=3D 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.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-256524-29464-tjTBi1Cwcw>