Dear all, I would like to report a potential memory leak in Binutils' sysinfo utility which prevents us from compiling the toolset with ASAN. I face the issue on Ubuntu 64-bit 14.04 and Binutils version is commit 09220eae9df07c40d206a35e6caaecba92ab8f46 Author: GDB Administrator <gdbadmin@sourceware.org> Date: Tue Mar 21 00:00:24 2017 +0000 Automatic date update in version.in I configured and compiled Binutils using the following commands using clang-3.5 mkdir build-asan; cd build-asan CC=clang CFLAGS="-DFORTIFY_SOURCE=2 -fstack-protector-all -fsanitize=undefined,address -fno-omit-frame-pointer -g -Wno-error" ../configure --disable-shared --disable-gdb --disable-libdecnumber --disable-readline --disable-sim make clean all Here is the error message I got: ================================================================= ==92396==ERROR: LeakSanitizer: detected memory leaks Direct leak of 7122 byte(s) in 755 object(s) allocated from: #0 0x49c29b in __interceptor_malloc (/home/ubuntu/subjects/binutils-newest/build-asan/binutils/sysinfo+0x49c29b) #1 0x4c7161 in yylex /home/ubuntu/subjects/binutils-newest/build-asan/binutils/../../binutils/syslex.l:51:13 #2 0x4bb13c in yyparse /home/ubuntu/subjects/binutils-newest/build-asan/binutils/sysinfo.c:1177:16 #3 0x4c4c05 in main /home/ubuntu/subjects/binutils-newest/build-asan/binutils/../../binutils/sysinfo.y:420:3 #4 0x2b604a4def44 in __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:287 SUMMARY: AddressSanitizer: 7122 byte(s) leaked in 755 allocation(s). Regards, Thuan
Hi Thuan, > I would like to report a potential memory leak in Binutils' sysinfo utility > which prevents us from compiling the toolset with ASAN. I looked into this a while ago. In the end though I decided that fixing the leaks was likely to introduce more bugs, and that it just was not worth it for such a minor file. The leaks are just too small to be worth worrying about. Instead I set the ASAN_OPTIONS environment variable to ignore the leaks: setenv ASAN_OPTIONS "detect_leaks=false" or export ASAN_OPTIONS="detect_leaks=false" if you use bash... Cheers Nick
*** Bug 21282 has been marked as a duplicate of this bug. ***
fwiw, ASAN provides '__SANITIZE_ADDRESS__' defines if we wanted to throw random free() calls around, although not sure that'd help in this particular case.
Hi Nick, Thank you. Your suggestion resolves the reported issue. Cheers, Thuan