public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug backends/22196] New: possible memory leak in libcpu in elfutils 0.170(HEAD)
@ 2017-09-24  9:30 luanjunchao at 163 dot com
  2017-09-25 19:14 ` [Bug backends/22196] possible memory leak in libcpu i386_gendis mark at klomp dot org
  0 siblings, 1 reply; 2+ messages in thread
From: luanjunchao at 163 dot com @ 2017-09-24  9:30 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 22196
           Summary: possible memory leak in libcpu in elfutils 0.170(HEAD)
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: backends
          Assignee: unassigned at sourceware dot org
          Reporter: luanjunchao at 163 dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

When I compile elfutils from the latest source code of git with address
sanitizer, it aborted with memory leak.

The command I run is "./configure CFLAGS='-g -fsanitize=address' CXXFLAGS='-g
-fsanitize=address' --enable-maintainer-mode && make".

Part of the log is as follows:

......
Making all in libcpu
  GEN      i386_defs
  GEN      i386.mnemonics
  CC       i386_gendis.o
  LEX      i386_lex.c
  YACC     i386_parse.c
updating i386_parse.h
  CC       i386_lex.o
  CC       i386_parse.o
  CCLD     i386_gendis
  GEN      i386_dis.h

=================================================================
==19600==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 17088 byte(s) in 3745 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x412186 in xstrndup /work/elfutils-asan/lib/xstrndup.c:44
    #3 0x402bd3 in i386_lex /work/elfutils-asan/libcpu/i386_lex.l:75
    #4 0x407a10 in i386_parse /work/elfutils-asan/libcpu/i386_parse.c:1398
    #5 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #6 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 10608 byte(s) in 663 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x409b5e in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:474
    #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #4 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 1248 byte(s) in 52 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x40a388 in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:534
    #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #4 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 44064 byte(s) in 1836 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x409d5d in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:493
    #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #4 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 9168 byte(s) in 573 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x409a21 in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:467
    #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #4 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 1344 byte(s) in 56 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x40a1c3 in i386_parse /work/elfutils-asan/libcpu/i386_parse.y:525
    #3 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #4 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 167 byte(s) in 52 object(s) allocated from:
    #0 0x7ff12d6ba602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4122e6 in xmalloc /work/elfutils-asan/lib/xmalloc.c:51
    #2 0x412186 in xstrndup /work/elfutils-asan/lib/xstrndup.c:44
    #3 0x402e31 in i386_lex /work/elfutils-asan/libcpu/i386_lex.l:82
    #4 0x407a10 in i386_parse /work/elfutils-asan/libcpu/i386_parse.c:1398
    #5 0x401acb in main /work/elfutils-asan/libcpu/i386_gendis.c:69
    #6 0x7ff12cf6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 83687 byte(s) leaked in 6977 allocation(s).
Makefile:730: recipe for target 'i386_dis.h' failed
make[2]: *** [i386_dis.h] Error 23
rm i386_defs
Makefile:485: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
Makefile:401: recipe for target 'all' failed
make: *** [all] Error 2

It shows there are memory leaks in i386 arch and I wonder if there are memory
leaks in other archs.

The os version is ubuntu 16.04 amd64 and I can reproduce it.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug backends/22196] possible memory leak in libcpu i386_gendis
  2017-09-24  9:30 [Bug backends/22196] New: possible memory leak in libcpu in elfutils 0.170(HEAD) luanjunchao at 163 dot com
@ 2017-09-25 19:14 ` mark at klomp dot org
  0 siblings, 0 replies; 2+ messages in thread
From: mark at klomp dot org @ 2017-09-25 19:14 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org
            Summary|possible memory leak in     |possible memory leak in
                   |libcpu in elfutils          |libcpu i386_gendis
                   |0.170(HEAD)                 |

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Note that i386_gendis is only used during the build (it is an noinst_PROGRAMS)
to generate the libcpu/i386_dis.h file. So any memory leaks in it aren't of
much concern.

Also note that you can configure --enable-valgrind to run all tests under
valgrind. Which makes tests fail if there are any memory leaks.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-25 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-24  9:30 [Bug backends/22196] New: possible memory leak in libcpu in elfutils 0.170(HEAD) luanjunchao at 163 dot com
2017-09-25 19:14 ` [Bug backends/22196] possible memory leak in libcpu i386_gendis mark at klomp dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).