Bug 24234 - objdump: Out of memory in xmalloc.c
Summary: objdump: Out of memory in xmalloc.c
Status: RESOLVED WONTFIX
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-19 10:02 UTC by spinpx
Modified: 2019-02-19 12:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
inputs trigger the bugs (169 bytes, application/octet-stream)
2019-02-19 10:02 UTC, spinpx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spinpx 2019-02-19 10:02:20 UTC
Created attachment 11616 [details]
inputs trigger the bugs

- Intel Xeon Gold 5118 processors and 256 GB memory
- Linux n18-065-139 4.19.0-1-amd64 #1 SMP Debian 4.19.12-1 (2018-12-22) x86_64 GNU/Linux
- clang version 4.0.0 (tags/RELEASE_400/final)
- version: commit c72e75a64030b0f6535a80481f37968ad55c333a (Feb 19 2019)
- run objdump -x input_file

- asan report

==1247614==ERROR: AddressSanitizer failed to allocate 0x5500002000 (365072228352) bytes of LargeMmapAllocator (error code: 12)
==1247614==Process memory map follows:
	0x000000400000-0x00000041d000	/mnt/raid/user/chenpeng/FuzzingBench/build/asan/install/bin/objdump
	0x00000041d000-0x000000996000	/mnt/raid/user/chenpeng/FuzzingBench/build/asan/install/bin/objdump
	0x000000996000-0x000000bc9000	/mnt/raid/user/chenpeng/FuzzingBench/build/asan/install/bin/objdump
	0x000000bca000-0x000000bcb000	/mnt/raid/user/chenpeng/FuzzingBench/build/asan/install/bin/objdump
	0x000000bcb000-0x000000c78000	/mnt/raid/user/chenpeng/FuzzingBench/build/asan/install/bin/objdump
	0x000000c78000-0x0000018e9000	
	0x00007fff7000-0x00008fff7000	
	0x00008fff7000-0x02008fff7000	
	0x02008fff7000-0x10007fff8000	
	0x600000000000-0x602000000000	
	0x602000000000-0x602000010000	
	0x602000010000-0x602e00000000	
	0x602e00000000-0x602e00010000	
	0x602e00010000-0x603000000000	
	0x603000000000-0x603000010000	
	0x603000010000-0x603e00000000	
	0x603e00000000-0x603e00010000	
	0x603e00010000-0x604000000000	
	0x604000000000-0x604000010000	
	0x604000010000-0x604e00000000	
	0x604e00000000-0x604e00010000	
	0x604e00010000-0x606000000000	
	0x606000000000-0x606000010000	
	0x606000010000-0x606e00000000	
	0x606e00000000-0x606e00010000	
	0x606e00010000-0x607000000000	
	0x607000000000-0x607000010000	
	0x607000010000-0x607e00000000	
	0x607e00000000-0x607e00010000	
	0x607e00010000-0x608000000000	
	0x608000000000-0x608000010000	
	0x608000010000-0x608e00000000	
	0x608e00000000-0x608e00010000	
	0x608e00010000-0x60b000000000	
	0x60b000000000-0x60b000010000	
	0x60b000010000-0x60be00000000	
	0x60be00000000-0x60be00010000	
	0x60be00010000-0x60c000000000	
	0x60c000000000-0x60c000010000	
	0x60c000010000-0x60ce00000000	
	0x60ce00000000-0x60ce00010000	
	0x60ce00010000-0x60f000000000	
	0x60f000000000-0x60f000010000	
	0x60f000010000-0x60fe00000000	
	0x60fe00000000-0x60fe00010000	
	0x60fe00010000-0x610000000000	
	0x610000000000-0x610000010000	
	0x610000010000-0x610e00000000	
	0x610e00000000-0x610e00010000	
	0x610e00010000-0x611000000000	
	0x611000000000-0x611000010000	
	0x611000010000-0x611e00000000	
	0x611e00000000-0x611e00010000	
	0x611e00010000-0x612000000000	
	0x612000000000-0x612000010000	
	0x612000010000-0x612e00000000	
	0x612e00000000-0x612e00010000	
	0x612e00010000-0x614000000000	
	0x614000000000-0x614000010000	
	0x614000010000-0x614e00000000	
	0x614e00000000-0x614e00010000	
	0x614e00010000-0x616000000000	
	0x616000000000-0x616000010000	
	0x616000010000-0x616e00000000	
	0x616e00000000-0x616e00010000	
	0x616e00010000-0x618000000000	
	0x618000000000-0x618000010000	
	0x618000010000-0x618e00000000	
	0x618e00000000-0x618e00010000	
	0x618e00010000-0x619000000000	
	0x619000000000-0x619000010000	
	0x619000010000-0x619e00000000	
	0x619e00000000-0x619e00010000	
	0x619e00010000-0x61a000000000	
	0x61a000000000-0x61a000010000	
	0x61a000010000-0x61ae00000000	
	0x61ae00000000-0x61ae00010000	
	0x61ae00010000-0x61b000000000	
	0x61b000000000-0x61b000010000	
	0x61b000010000-0x61be00000000	
	0x61be00000000-0x61be00010000	
	0x61be00010000-0x61d000000000	
	0x61d000000000-0x61d000010000	
	0x61d000010000-0x61de00000000	
	0x61de00000000-0x61de00010000	
	0x61de00010000-0x61f000000000	
	0x61f000000000-0x61f000010000	
	0x61f000010000-0x61fe00000000	
	0x61fe00000000-0x61fe00010000	
	0x61fe00010000-0x621000000000	
	0x621000000000-0x621000010000	
	0x621000010000-0x621e00000000	
	0x621e00000000-0x621e00010000	
	0x621e00010000-0x624000000000	
	0x624000000000-0x624000010000	
	0x624000010000-0x624e00000000	
	0x624e00000000-0x624e00010000	
	0x624e00010000-0x62d000000000	
	0x62d000000000-0x62d000010000	
	0x62d000010000-0x62de00000000	
	0x62de00000000-0x62de00010000	
	0x62de00010000-0x640000000000	
	0x640000000000-0x640000003000	
	0x7f9b2ad66000-0x7f9b2b7e0000	/usr/lib/locale/locale-archive
	0x7f9b2b7e0000-0x7f9b2ba00000	
	0x7f9b2bb00000-0x7f9b2bc00000	
	0x7f9b2bc8a000-0x7f9b2bc9e000	
	0x7f9b2bc9e000-0x7f9b2bca5000	/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
	0x7f9b2bca5000-0x7f9b2e05f000	
	0x7f9b2e05f000-0x7f9b2e081000	/lib/x86_64-linux-gnu/libc-2.28.so
	0x7f9b2e081000-0x7f9b2e1c9000	/lib/x86_64-linux-gnu/libc-2.28.so
	0x7f9b2e1c9000-0x7f9b2e215000	/lib/x86_64-linux-gnu/libc-2.28.so
	0x7f9b2e215000-0x7f9b2e216000	/lib/x86_64-linux-gnu/libc-2.28.so
	0x7f9b2e216000-0x7f9b2e21a000	/lib/x86_64-linux-gnu/libc-2.28.so
	0x7f9b2e21a000-0x7f9b2e21c000	/lib/x86_64-linux-gnu/libc-2.28.so
	0x7f9b2e21c000-0x7f9b2e220000	
	0x7f9b2e220000-0x7f9b2e223000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f9b2e223000-0x7f9b2e234000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f9b2e234000-0x7f9b2e237000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f9b2e237000-0x7f9b2e238000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f9b2e238000-0x7f9b2e239000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f9b2e239000-0x7f9b2e23a000	/lib/x86_64-linux-gnu/libgcc_s.so.1
	0x7f9b2e23a000-0x7f9b2e23b000	/lib/x86_64-linux-gnu/libdl-2.28.so
	0x7f9b2e23b000-0x7f9b2e23c000	/lib/x86_64-linux-gnu/libdl-2.28.so
	0x7f9b2e23c000-0x7f9b2e23d000	/lib/x86_64-linux-gnu/libdl-2.28.so
	0x7f9b2e23d000-0x7f9b2e23e000	/lib/x86_64-linux-gnu/libdl-2.28.so
	0x7f9b2e23e000-0x7f9b2e23f000	/lib/x86_64-linux-gnu/libdl-2.28.so
	0x7f9b2e23f000-0x7f9b2e24c000	/lib/x86_64-linux-gnu/libm-2.28.so
	0x7f9b2e24c000-0x7f9b2e2eb000	/lib/x86_64-linux-gnu/libm-2.28.so
	0x7f9b2e2eb000-0x7f9b2e3c0000	/lib/x86_64-linux-gnu/libm-2.28.so
	0x7f9b2e3c0000-0x7f9b2e3c1000	/lib/x86_64-linux-gnu/libm-2.28.so
	0x7f9b2e3c1000-0x7f9b2e3c2000	/lib/x86_64-linux-gnu/libm-2.28.so
	0x7f9b2e3c2000-0x7f9b2e3c4000	/lib/x86_64-linux-gnu/librt-2.28.so
	0x7f9b2e3c4000-0x7f9b2e3c8000	/lib/x86_64-linux-gnu/librt-2.28.so
	0x7f9b2e3c8000-0x7f9b2e3ca000	/lib/x86_64-linux-gnu/librt-2.28.so
	0x7f9b2e3ca000-0x7f9b2e3cb000	/lib/x86_64-linux-gnu/librt-2.28.so
	0x7f9b2e3cb000-0x7f9b2e3cc000	/lib/x86_64-linux-gnu/librt-2.28.so
	0x7f9b2e3cc000-0x7f9b2e3d2000	/lib/x86_64-linux-gnu/libpthread-2.28.so
	0x7f9b2e3d2000-0x7f9b2e3e1000	/lib/x86_64-linux-gnu/libpthread-2.28.so
	0x7f9b2e3e1000-0x7f9b2e3e7000	/lib/x86_64-linux-gnu/libpthread-2.28.so
	0x7f9b2e3e7000-0x7f9b2e3e8000	/lib/x86_64-linux-gnu/libpthread-2.28.so
	0x7f9b2e3e8000-0x7f9b2e3e9000	/lib/x86_64-linux-gnu/libpthread-2.28.so
	0x7f9b2e3e9000-0x7f9b2e3ed000	
	0x7f9b2e3ed000-0x7f9b2e3fc000	
	0x7f9b2e3fc000-0x7f9b2e3fd000	/lib/x86_64-linux-gnu/ld-2.28.so
	0x7f9b2e3fd000-0x7f9b2e41b000	/lib/x86_64-linux-gnu/ld-2.28.so
	0x7f9b2e41b000-0x7f9b2e423000	/lib/x86_64-linux-gnu/ld-2.28.so
	0x7f9b2e423000-0x7f9b2e424000	/lib/x86_64-linux-gnu/ld-2.28.so
	0x7f9b2e424000-0x7f9b2e425000	/lib/x86_64-linux-gnu/ld-2.28.so
	0x7f9b2e425000-0x7f9b2e426000	
	0x7ffe3f311000-0x7ffe3f332000	[stack]
	0x7ffe3f3c2000-0x7ffe3f3c5000	[vvar]
	0x7ffe3f3c5000-0x7ffe3f3c7000	[vdso]
==1247614==End of process memory map.
==1247614==AddressSanitizer CHECK failed: /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.cc:120 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
    #0 0x4cbcef in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/asan/asan_rtl.cc:69:3
    #1 0x4df64f in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc:79:5
    #2 0x4d0c5e in __sanitizer::ReportMmapFailureAndDie(unsigned long, char const*, char const*, int, bool) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.cc:120:3
    #3 0x4d967b in __sanitizer::MmapOrDie(unsigned long, char const*, bool) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc:132:5
    #4 0x421e54 in __sanitizer::LargeMmapAllocator<__asan::AsanMapUnmapCallback>::Allocate(__sanitizer::AllocatorStats*, unsigned long, unsigned long) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_allocator_secondary.h:41:9
    #5 0x421c08 in __sanitizer::CombinedAllocator<__sanitizer::SizeClassAllocator64<__asan::AP64>, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator64<__asan::AP64> >, __sanitizer::LargeMmapAllocator<__asan::AsanMapUnmapCallback> >::Allocate(__sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator64<__asan::AP64> >*, unsigned long, unsigned long, bool, bool) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_allocator_combined.h:70:24
    #6 0x41f0bf in __asan::Allocator::Allocate(unsigned long, unsigned long, __sanitizer::BufferedStackTrace*, __asan::AllocType, bool) /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/asan/asan_allocator.cc:407:21
    #7 0x4c43f0 in malloc /scratch/llvm/clang-4/xenial/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:67:10
    #8 0x995467 in xmalloc /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/libiberty/xmalloc.c:147:12
    #9 0x4f6d06 in slurp_symtab /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/binutils/objdump.c:697:23
    #10 0x4f528f in dump_bfd /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/binutils/objdump.c:3793:12
    #11 0x4f4c71 in display_object_bfd /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/binutils/objdump.c:3883:7
    #12 0x4f4b67 in display_any_bfd /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/binutils/objdump.c:3973:5
    #13 0x4f424a in display_file /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/binutils/objdump.c:3994:3
    #14 0x4f3ab0 in main /mnt/raid/user/chenpeng/FuzzingBench/binutils/binutils-gdb/binutils/objdump.c:4304:6
    #15 0x7f9b2e08309a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #16 0x41d639 in _start (/mnt/raid/user/chenpeng/FuzzingBench/build/asan/install/bin/objdump+0x41d639)
Comment 1 spinpx 2019-02-19 10:04:45 UTC
Also report on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89398
Comment 2 Alan Modra 2019-02-19 12:12:34 UTC
OK, so here I do get a fail.
binutils/objdump: out of memory allocating 365072220160 bytes after a total of 53248 bytes.

The file has a symbol table claiming to be 0xff00000000 byte in size, or 0xaa0000000 symbols, requiring that rather huge amount of memory.  Since this is driven by user input rather than due to some bug in binutils, it is quite reasonable to report an out of memory error and exit.