public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/21312] New: eu-elflint: memory allocation failure in xcalloc (xmalloc.c)
@ 2017-03-27 10:46 ago at gentoo dot org
  2017-03-27 23:28 ` [Bug tools/21312] " mark at klomp dot org
  2017-04-03 22:25 ` mark at klomp dot org
  0 siblings, 2 replies; 3+ messages in thread
From: ago at gentoo dot org @ 2017-03-27 10:46 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 21312
           Summary: eu-elflint: memory allocation failure in xcalloc
                    (xmalloc.c)
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: ago at gentoo dot org
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

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

On elfutils-0.168:

# eu-elflint -d $FILE
==5053==AddressSanitizer CHECK failed:
/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_common.cc:180
"((0 && "unable to mmap")) != (0)" (0x0, 0x0)
    #7 0x431b8d in xcalloc
/tmp/portage/dev-libs/elfutils-0.168/work/elfutils-0.168/lib/xmalloc.c:64


Compiled with: gcc-6.3.0

Reproducer:
https://github.com/asarubbo/poc/blob/master/00236-elfutils-memallocfailure

Stacktrace attached.

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

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

* [Bug tools/21312] eu-elflint: memory allocation failure in xcalloc (xmalloc.c)
  2017-03-27 10:46 [Bug tools/21312] New: eu-elflint: memory allocation failure in xcalloc (xmalloc.c) ago at gentoo dot org
@ 2017-03-27 23:28 ` mark at klomp dot org
  2017-04-03 22:25 ` mark at klomp dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2017-03-27 23:28 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
The allocation failure is caused by the insane large ph_num. We can limit the
amount of memory we need by first checking we can at least read the headers and
only allocate/check that number (and do the same for shnum).
https://sourceware.org/ml/elfutils-devel/2017-q1/msg00133.html

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

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

* [Bug tools/21312] eu-elflint: memory allocation failure in xcalloc (xmalloc.c)
  2017-03-27 10:46 [Bug tools/21312] New: eu-elflint: memory allocation failure in xcalloc (xmalloc.c) ago at gentoo dot org
  2017-03-27 23:28 ` [Bug tools/21312] " mark at klomp dot org
@ 2017-04-03 22:25 ` mark at klomp dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2017-04-03 22:25 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
commit 4314716cd498bb51639db717bd7ce6182de33322
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Mar 28 01:25:34 2017 +0200

    elflint: Sanity check the number of phdrs and shdrs available.

    Make sure we can at least read the shnum sections or phnum segments.
    Limit the number we do check to those we can actually read.

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

    Signed-off-by: Mark Wielaard <mark@klomp.org>

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

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

end of thread, other threads:[~2017-04-03 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 10:46 [Bug tools/21312] New: eu-elflint: memory allocation failure in xcalloc (xmalloc.c) ago at gentoo dot org
2017-03-27 23:28 ` [Bug tools/21312] " mark at klomp dot org
2017-04-03 22:25 ` 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).