bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/23601] New: Memory leak dwarf.c


From: tianxiao.gu at gmail dot com
Subject: [Bug binutils/23601] New: Memory leak dwarf.c
Date: Fri, 31 Aug 2018 01:01:59 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23601

            Bug ID: 23601
           Summary: Memory leak dwarf.c
           Product: binutils
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: tianxiao.gu at gmail dot com
  Target Milestone: ---

Created attachment 11220
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11220&action=edit
File for reproducing the leak

Our fuzzing tool has recently detected a memory leak of objdump on binutils
2.31. We cannot verify the leak on the HEAD due to the following building
error.

./common/traits.h:96:33: error: no member named 'value' in 'IsRelocatable<type
*>'



Reproduce:
1. Download and unzip the attached file 299.zip

2. Run `objdump -g 299`


Output:

=================================================================
==28680==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 272 byte(s) in 1 object(s) allocated from:
    #0 0x50310d in realloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165
    #1 0xa1df2c in xrealloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:179:14
    #2 0x55cd18 in xcrealloc /home/txgu/binutils-2.31/binutils/dwarf.c:9533:10
    #3 0x59a735 in frame_need_space
/home/txgu/binutils-2.31/binutils/dwarf.c:6938:28
    #4 0x56d656 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7842:9
    #5 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #6 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #7 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #8 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #9 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #10 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #11 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #12 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #13 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 228 byte(s) in 1 object(s) allocated from:
    #0 0x50310d in realloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165
    #1 0xa1df2c in xrealloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:179:14
    #2 0x55cd18 in xcrealloc /home/txgu/binutils-2.31/binutils/dwarf.c:9533:10
    #3 0x59a735 in frame_need_space
/home/txgu/binutils-2.31/binutils/dwarf.c:6938:28
    #4 0x56be33 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7761:9
    #5 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #6 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #7 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #8 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #9 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #10 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #11 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #12 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #13 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 136 byte(s) in 1 object(s) allocated from:
    #0 0x50310d in realloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165
    #1 0xa1df2c in xrealloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:179:14
    #2 0x55cd18 in xcrealloc /home/txgu/binutils-2.31/binutils/dwarf.c:9533:10
    #3 0x59a637 in frame_need_space
/home/txgu/binutils-2.31/binutils/dwarf.c:6936:32
    #4 0x56d656 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7842:9
    #5 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #6 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #7 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #8 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #9 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #10 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #11 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #12 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #13 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 114 byte(s) in 1 object(s) allocated from:
    #0 0x50310d in realloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165
    #1 0xa1df2c in xrealloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:179:14
    #2 0x55cd18 in xcrealloc /home/txgu/binutils-2.31/binutils/dwarf.c:9533:10
    #3 0x59a637 in frame_need_space
/home/txgu/binutils-2.31/binutils/dwarf.c:6936:32
    #4 0x56be33 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7761:9
    #5 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #6 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #7 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #8 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #9 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #10 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #11 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #12 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #13 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x502cff in malloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146
    #1 0xa1de27 in xmalloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:147:12
    #2 0x572bb8 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:8112:29
    #3 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #4 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #5 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #6 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #7 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #8 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #9 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #10 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #11 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x502cff in malloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146
    #1 0xa1de27 in xmalloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:147:12
    #2 0x5986de in read_cie /home/txgu/binutils-2.31/binutils/dwarf.c:7269:24
    #3 0x569116 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7595:6
    #4 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #5 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #6 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #7 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #8 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #9 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #10 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #11 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #12 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x502cff in malloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146
    #1 0xa1de27 in xmalloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:147:12
    #2 0x5c0db3 in debug_init /home/txgu/binutils-2.31/binutils/debug.c:666:33
    #3 0x5be6e6 in read_debugging_info
/home/txgu/binutils-2.31/binutils/rddbg.c:51:13
    #4 0x5437b8 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3637:17
    #5 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #6 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #7 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #8 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #9 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x502edb in calloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:155
    #1 0x562faf in parse_gnu_debugaltlink
/home/txgu/binutils-2.31/binutils/dwarf.c:9722:19
    #2 0x56266c in load_separate_debug_info
/home/txgu/binutils-2.31/binutils/dwarf.c:9747:28
    #3 0x55d2f9 in load_separate_debug_file
/home/txgu/binutils-2.31/binutils/dwarf.c:9975:14
    #4 0x546280 in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2766:15
    #5 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #6 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #7 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #8 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #9 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #10 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Indirect leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x502cff in malloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146
    #1 0xa1de27 in xmalloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:147:12
    #2 0x55cc98 in xcmalloc /home/txgu/binutils-2.31/binutils/dwarf.c:9515:10
    #3 0x5730c5 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:8120:33
    #4 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #5 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #6 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #7 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #8 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #9 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #10 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #11 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #12 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Indirect leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x502cff in malloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146
    #1 0xa1de27 in xmalloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:147:12
    #2 0x55cc98 in xcmalloc /home/txgu/binutils-2.31/binutils/dwarf.c:9515:10
    #3 0x573008 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:8118:37
    #4 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #5 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #6 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #7 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #8 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #9 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #10 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #11 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #12 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Indirect leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x50310d in realloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165
    #1 0xa1df2c in xrealloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:179:14
    #2 0x55cd18 in xcrealloc /home/txgu/binutils-2.31/binutils/dwarf.c:9533:10
    #3 0x59a735 in frame_need_space
/home/txgu/binutils-2.31/binutils/dwarf.c:6938:28
    #4 0x569495 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7609:10
    #5 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #6 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #7 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #8 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #9 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #10 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #11 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #12 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #13 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x50310d in realloc
/home/txgu/Projects/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165
    #1 0xa1df2c in xrealloc
/home/txgu/binutils-2.31/libiberty/./xmalloc.c:179:14
    #2 0x55cd18 in xcrealloc /home/txgu/binutils-2.31/binutils/dwarf.c:9533:10
    #3 0x59a637 in frame_need_space
/home/txgu/binutils-2.31/binutils/dwarf.c:6936:32
    #4 0x569495 in display_debug_frames
/home/txgu/binutils-2.31/binutils/dwarf.c:7609:10
    #5 0x549bf1 in dump_dwarf_section
/home/txgu/binutils-2.31/binutils/./objdump.c:2694:6
    #6 0x66266e in bfd_map_over_sections
/home/txgu/binutils-2.31/bfd/section.c:1374:5
    #7 0x54629b in dump_dwarf
/home/txgu/binutils-2.31/binutils/./objdump.c:2768:3
    #8 0x5438c1 in dump_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3654:4
    #9 0x542e66 in display_object_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3688:7
    #10 0x542d47 in display_any_bfd
/home/txgu/binutils-2.31/binutils/./objdump.c:3777:5
    #11 0x542848 in display_file
/home/txgu/binutils-2.31/binutils/./objdump.c:3798:3
    #12 0x542078 in main /home/txgu/binutils-2.31/binutils/./objdump.c:4100:6
    #13 0x7fec2207bf44 in __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:287

SUMMARY: AddressSanitizer: 1450 byte(s) leaked in 12 allocation(s).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]