NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/54090 (gcc -fsanitize=address creates an unusable binary on amd64)



maya%NetBSD.org@localhost wrote:
> Synopsis: gcc -fsanitize=address creates an unusable binary on amd64
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: maya%NetBSD.org@localhost
> State-Changed-When: Tue, 28 May 2019 07:16:14 +0000
> State-Changed-Why:
> I believe christos has fixed this. Is it working for you?

It works when /proc is mounted with the "linux" flag and complains
about missing /proc/<<pid>>/task otherwise.

So, anyone who can recognise a linuxism here should be able to
figure out that /proc needs to be remounted with the "linux" flag.

It's not ideal but it's fine by me.

--
Alex

#include <stdlib.h>
int main() { malloc(4); return 0; }

# umount /proc
# mount_procfs -o linux none /proc

$ ./a.out

=================================================================
==14901==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x740abda260f8 in __interceptor_malloc /home/alnsn/netbsd-current/sljit/src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc:67
    #1 0x400a47 in main (/private/tmp/1000/./a.out+0x400a47)
    #2 0x40096c in ___start (/private/tmp/1000/./a.out+0x40096c)

SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).
HUP

# umount /proc
# mount_procfs -o nolinux none /proc

$ ./a.out
==15703==Can't open /proc/13091/task for reading.
==13091==LeakSanitizer has encountered a fatal error.
==13091==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==13091==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)


Home | Main Index | Thread Index | Old Index