Bug#836848: libasan3: AddressSanitizer breaks when LD_PRELOAD is defined
Package: libasan3
Version: 6.2.0-3
Severity: normal
When LD_PRELOAD is defined (which can be a consequence of gtk3-nocsd
being installed and the user being in an X11 session), I get:
cventin:~> gcc -fsanitize=address t.c
cventin:~> ./a.out
==22051==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
Something should be done. This was very confusing at first, because
the problem first came here when I ran a configure script which was
working a few days ago (after investigation, it is now clear that
the reason was that it wasn't under a X11 session a few days ago),
and just saw:
checking whether we are cross compiling... configure: error: in `/home/vlefevre/tmp/mpfr-old':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
I could see the error message, but the reason wasn't clear yet
(I initially thought of a regression after a recent upgrade).
So, I think that if possible, having LD_PRELOAD already set shouldn't
affect ASan. Shouldn't -static-libasan be the default, for instance?
If this is not possible, various things should be clarified:
1. The error message should be more informative, e.g. when LD_PRELOAD
is set, say that LD_PRELOAD is set but ASan runtime does not appear
in LD_PRELOAD or does not come first.
2. The gcc(1) man page does not mention LD_PRELOAD at all. Ditto for
the GCC manual.
3. How to find the right ASan runtime *automatically* should also be
documented.
-- System Information:
Debian Release: stretch/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.7.0-1-amd64 (SMP w/12 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libasan3 depends on:
ii gcc-6-base 6.2.0-3
ii libc6 2.24-2
ii libgcc1 1:6.2.0-3
ii libstdc++6 6.2.0-3
libasan3 recommends no packages.
libasan3 suggests no packages.
-- no debconf information
Reply to: