public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug.
@ 2018-10-16  7:18 wcventure at 126 dot com
  2018-10-16  7:18 ` [Bug libdw/23782] " wcventure at 126 dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: wcventure at 126 dot com @ 2018-10-16  7:18 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 23782
           Summary: Negative-size-param problem in dwfl_getmodules.c in
                    libdw, please use the POC to reproduce this bug.
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: wcventure at 126 dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

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

Hi,

We are doing research on fuzz testing and our fuzzer caught a
Negative-size-param problem in the latest elfutils(v0.174) code base. The
funciton dwfl_getmodules in dwfl_getmodules.c library does not ensure a
non-negative size. Those inputs will cause the Negative-size-param Problem,
Segmentation fault. I have confirmed them with address sanitizer. 

Please use the “ ./eu-readelf $POC -w ” to reproduce the bug. If you have any
questions, please let me know. Thank you.

The ASAN dumps the stack trace as follows:

==31028==ERROR: AddressSanitizer: negative-size-param: (size=-4)
    #0 0x7ff2abbf4866  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x41866)
    #1 0x4973ad in print_debug_frame_section
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/src/readelf.c:6626
    #2 0x4598f3 in print_debug
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/src/readelf.c:11160
    #3 0x45e00a in process_elf_file
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/src/readelf.c:996
    #4 0x45e00a in process_dwflmod
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/src/readelf.c:760
    #5 0x7ff2ab8be2f4 in dwfl_getmodules
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/libdwfl/dwfl_getmodules.c:86
    #6 0x40d055 in process_file
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/src/readelf.c:868
    #7 0x4058f1 in main
/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/src/readelf.c:350
    #8 0x7ff2aaf4682f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #9 0x4064d8 in _start
(/media/hjwang/01D3344861A8D2E0/wcventure/Project/elfutils/build/bin/eu-readelf+0x4064d8)

Address 0x7ff2acca407d is a wild pointer.
SUMMARY: AddressSanitizer: negative-size-param
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0x41866)
==31028==ABORTING
Aborted

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

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

* [Bug libdw/23782] Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug.
  2018-10-16  7:18 [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug wcventure at 126 dot com
  2018-10-16  7:18 ` [Bug libdw/23782] " wcventure at 126 dot com
@ 2018-10-16  7:18 ` wcventure at 126 dot com
  2018-10-16 12:26 ` [Bug libdw/23782] Negative-size-param in call to in memchr from readelf print_debug_frame_section mark at klomp dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: wcventure at 126 dot com @ 2018-10-16  7:18 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #2 from wcventure <wcventure at 126 dot com> ---
Created attachment 11333
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11333&action=edit
POC3

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

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

* [Bug libdw/23782] Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug.
  2018-10-16  7:18 [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug wcventure at 126 dot com
@ 2018-10-16  7:18 ` wcventure at 126 dot com
  2018-10-16  7:18 ` wcventure at 126 dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: wcventure at 126 dot com @ 2018-10-16  7:18 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #1 from wcventure <wcventure at 126 dot com> ---
Created attachment 11332
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11332&action=edit
POC2

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

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

* [Bug libdw/23782] Negative-size-param in call to in memchr from readelf print_debug_frame_section
  2018-10-16  7:18 [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug wcventure at 126 dot com
  2018-10-16  7:18 ` [Bug libdw/23782] " wcventure at 126 dot com
  2018-10-16  7:18 ` wcventure at 126 dot com
@ 2018-10-16 12:26 ` mark at klomp dot org
  2018-10-19 22:57 ` mark at klomp dot org
  2021-03-20 16:36 ` mily000rose at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: mark at klomp dot org @ 2018-10-16 12:26 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-10-16
                 CC|                            |mark at klomp dot org
            Summary|Negative-size-param problem |Negative-size-param in call
                   |in dwfl_getmodules.c in     |to in memchr from readelf
                   |libdw, please use the POC   |print_debug_frame_section
                   |to reproduce this bug.      |
     Ever confirmed|0                           |1

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Thanks for the report. I retitled the bug to better show where the issue shows
up. I posted a fix:
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00042.html

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

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

* [Bug libdw/23782] Negative-size-param in call to in memchr from readelf print_debug_frame_section
  2018-10-16  7:18 [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug wcventure at 126 dot com
                   ` (2 preceding siblings ...)
  2018-10-16 12:26 ` [Bug libdw/23782] Negative-size-param in call to in memchr from readelf print_debug_frame_section mark at klomp dot org
@ 2018-10-19 22:57 ` mark at klomp dot org
  2021-03-20 16:36 ` mily000rose at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: mark at klomp dot org @ 2018-10-19 22:57 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

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

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
commit 72d023b35f3639864b61bd1c11aaadc4957e6286
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Oct 16 14:22:33 2018 +0200

    readelf: Make sure readp is smaller than cieend in
print_debug_frame_section.

    We could end up with a negative length in a call to memchr.

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

    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] 6+ messages in thread

* [Bug libdw/23782] Negative-size-param in call to in memchr from readelf print_debug_frame_section
  2018-10-16  7:18 [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug wcventure at 126 dot com
                   ` (3 preceding siblings ...)
  2018-10-19 22:57 ` mark at klomp dot org
@ 2021-03-20 16:36 ` mily000rose at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: mily000rose at gmail dot com @ 2021-03-20 16:36 UTC (permalink / raw)
  To: elfutils-devel

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

Mily Rose <mily000rose at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mily000rose at gmail dot com

--- Comment #5 from Mily Rose <mily000rose at gmail dot com> ---
It’s a good reference. I’m an IT student and I face lots of difficulties during
my projects. 
https://rheumatologyhelps.com/rheumatology/foods-that-trigger-rheumatology-arthritis/
 And this site always saves me. It helps me a lot in my projects. Thank you so
much for that.

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

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

end of thread, other threads:[~2021-03-20 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16  7:18 [Bug libdw/23782] New: Negative-size-param problem in dwfl_getmodules.c in libdw, please use the POC to reproduce this bug wcventure at 126 dot com
2018-10-16  7:18 ` [Bug libdw/23782] " wcventure at 126 dot com
2018-10-16  7:18 ` wcventure at 126 dot com
2018-10-16 12:26 ` [Bug libdw/23782] Negative-size-param in call to in memchr from readelf print_debug_frame_section mark at klomp dot org
2018-10-19 22:57 ` mark at klomp dot org
2021-03-20 16:36 ` mily000rose at gmail dot com

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).