This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug general/24086] New: Multiple memory leak issues were discovered in in libelf and libdwelf


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

            Bug ID: 24086
           Summary: Multiple memory leak issues were discovered in in
                    libelf and libdwelf
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: general
          Assignee: unassigned at sourceware dot org
          Reporter: wcventure at 126 dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 11532
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11532&action=edit
POC

Hi there, 
We have discover lots of memory leak in libelf and libdwelf. Multiple memory
leak issues were discovered in libelf and libdwelf, as distributed in Elfutils
0.174. 
There are many heap allocations. But these heap allocations didn't deallocate
in the end. 

Please use the "./eu-strip $POC" to reproduce the bug.


The ASAN dumps the stack trace as follows:

> =================================================================
> ==22066==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 6712 byte(s) in 1 object(s) allocated from:
>     #0 0x7f3aeabb6d78 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded78)
>     #1 0x7f3aea8b5a38 in allocate_elf /home/wencheng/Experiment/elfutils/libelf/common.h:74
>     #2 0x7f3aea8b5a38 in elf_clone /home/wencheng/Experiment/elfutils/libelf/elf_clone.c:56
> 
> Direct leak of 96 byte(s) in 1 object(s) allocated from:
>     #0 0x7f3aeabb6d78 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded78)
>     #1 0x7f3aea39b1b2 in dwelf_strtab_init /home/wencheng/Experiment/elfutils/libdwelf/dwelf_strtab.c:94
>     #2 0x44406d in process_file /home/wencheng/Experiment/elfutils/src/strip.c:769
> 
> Indirect leak of 4080 byte(s) in 1 object(s) allocated from:
>     #0 0x7f3aeabb6b90 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb90)
>     #1 0x7f3aea39a787 in morememory /home/wencheng/Experiment/elfutils/libdwelf/dwelf_strtab.c:120
>     #2 0x7f3aea39a787 in newstring /home/wencheng/Experiment/elfutils/libdwelf/dwelf_strtab.c:161
>     #3 0x7f3aea39a787 in strtab_add /home/wencheng/Experiment/elfutils/libdwelf/dwelf_strtab.c:221
> 
> Indirect leak of 1120 byte(s) in 28 object(s) allocated from:
>     #0 0x7f3aeabb6d78 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded78)
>     #1 0x7f3aea82ab3e in elf_newscn /home/wencheng/Experiment/elfutils/libelf/elf_newscn.c:125
> 
> Indirect leak of 288 byte(s) in 1 object(s) allocated from:
>     #0 0x7f3aeabb6f80 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef80)
>     #1 0x7f3aea812223 in elf32_newphdr /home/wencheng/Experiment/elfutils/libelf/elf32_newphdr.c:134
> 
> Indirect leak of 240 byte(s) in 1 object(s) allocated from:
>     #0 0x7f3aeabb6b90 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb90)
>     #1 0x7f3aea39bd0c in dwelf_strtab_finalize /home/wencheng/Experiment/elfutils/libdwelf/dwelf_strtab.c:322
>     #2 0x7f3aea56c2bf  (/home/wencheng/Experiment/elfutils/build/lib/libdw.so.1+0x3852bf)
> 
> SUMMARY: AddressSanitizer: 12536 byte(s) leaked in 33 allocation(s).

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]