public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
@ 2018-10-10 13:02 wcventure at 126 dot com
  2018-10-10 13:03 ` [Bug tools/23755] " wcventure at 126 dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: wcventure at 126 dot com @ 2018-10-10 13:02 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 23755
           Summary: Multiple floating point exception in findtextrel.c in
                    eu-findtextrel biniary of elfutils-v.0174.
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: wcventure at 126 dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

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

Hi,

I found some floating point exception in findtextrel.c in eu-findtextrel of the
latest elfutils-0.174 code base. I have confirmed them with GDB and address
sanitizer.

Here are the POC files. I'll also show you the debugging process. It seems that
this is caused by the divide-by-zero problem.

> gdb --args ./eu-findtextrel POC3-findtextrel
> GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
> ...
> Reading symbols from ./eu-findtextrel...done.
> (gdb) b 418
> Breakpoint 1 at 0x40379c: file findtextrel.c, line 418.
> (gdb) start
> Temporary breakpoint 2, main (argc=2, argv=0x7ffffffedfc8) at findtextrel.c:107
> 107     {
> (gdb) c
> Continuing.
> Breakpoint 1, process_file (fname=0x7ffffffee247 "POC3-findtextrel", more_than_one=false) at findtextrel.c:418
> 418                        (size_t) cnt < shdr->sh_size / shdr->sh_entsize;
> (gdb) p shdr->sh_entsize
> $2 = 0
> (gdb) n
> 
> Program received signal SIGFPE, Arithmetic exception.
> 0x0000000000403810 in process_file (fname=0x7ffffffee247 "POC3-findtextrel", more_than_one=false) at findtextrel.c:418
> 418                        (size_t) cnt < shdr->sh_size / shdr->sh_entsize;

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

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

* [Bug tools/23755] Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
  2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
@ 2018-10-10 13:03 ` wcventure at 126 dot com
  2018-10-10 13:04 ` wcventure at 126 dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: wcventure at 126 dot com @ 2018-10-10 13:03 UTC (permalink / raw)
  To: elfutils-devel

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

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

Here is the POC2.
Please use " ./eu-findtextrel $POC " to reproduce this bug. If you have any
questions, please let me know.

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

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

* [Bug tools/23755] Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
  2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
  2018-10-10 13:03 ` [Bug tools/23755] " wcventure at 126 dot com
@ 2018-10-10 13:04 ` wcventure at 126 dot com
  2018-10-10 16:09 ` wcventure at 126 dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: wcventure at 126 dot com @ 2018-10-10 13:04 UTC (permalink / raw)
  To: elfutils-devel

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

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

Here is the POC3.
Please use " ./eu-findtextrel $POC " to reproduce this bug. If you have any
questions, please let me know.

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

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

* [Bug tools/23755] Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
  2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
  2018-10-10 13:03 ` [Bug tools/23755] " wcventure at 126 dot com
  2018-10-10 13:04 ` wcventure at 126 dot com
@ 2018-10-10 16:09 ` wcventure at 126 dot com
  2018-10-14 15:01 ` mark at klomp dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: wcventure at 126 dot com @ 2018-10-10 16:09 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #3 from wcventure <wcventure at 126 dot com> ---
I have also confirmed them with address sanitizer. 
For example, The ASAN dumps the stack trace as follows:

ASAN:DEADLYSIGNAL
=================================================================
==8794==ERROR: AddressSanitizer: FPE on unknown address 0x000000403810 (pc
0x000000403810 bp 0x7fffca34e600 sp 0x7fffca34e050 T0)
    #0 0x40380f in process_file /elfutils-0.174/src/findtextrel.c:418
    #1 0x401c24 in main /elfutils-0.174/src/findtextrel.c:147
    #2 0x7f74edb0082f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #3 0x401958 in _start (/elfutils-0.174/build/bin/eu-findtextrel+0x401958)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE
/mnt/c/wcventure/Fuzzing_Object/elfutils-0.174/src/findtextrel.c:418 in
process_file
==8794==ABORTING

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

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

* [Bug tools/23755] Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
  2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
                   ` (2 preceding siblings ...)
  2018-10-10 16:09 ` wcventure at 126 dot com
@ 2018-10-14 15:01 ` mark at klomp dot org
  2018-10-14 16:22 ` wcventure at 126 dot com
  2018-10-19 22:27 ` mark at klomp dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mark at klomp dot org @ 2018-10-14 15:01 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-10-14
                 CC|                            |mark at klomp dot org
     Ever confirmed|0                           |1

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
Yeah, divide by zero is bad. Proposed fix:
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00024.html

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

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

* [Bug tools/23755] Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
  2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
                   ` (3 preceding siblings ...)
  2018-10-14 15:01 ` mark at klomp dot org
@ 2018-10-14 16:22 ` wcventure at 126 dot com
  2018-10-19 22:27 ` mark at klomp dot org
  5 siblings, 0 replies; 7+ messages in thread
From: wcventure at 126 dot com @ 2018-10-14 16:22 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #5 from wcventure <wcventure at 126 dot com> ---
Thanks for paying attention to this problem and proposing to fix it in time.
This bug was discovered by NTU Cyber-Security-Lab, for fuzzing research work.

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

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

* [Bug tools/23755] Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174.
  2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
                   ` (4 preceding siblings ...)
  2018-10-14 16:22 ` wcventure at 126 dot com
@ 2018-10-19 22:27 ` mark at klomp dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mark at klomp dot org @ 2018-10-19 22:27 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

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

--- Comment #6 from Mark Wielaard <mark at klomp dot org> ---
commit 577511f66842c324c811d1530eea32792f2bee29
Author: Mark Wielaard <mark@klomp.org>
Date:   Sun Oct 14 16:58:51 2018 +0200

    findtextrel: Check that sh_entsize isn't zero.

    A bogus ELF file could have sh_entsize as zero. Don't divide by zero,
    but just assume there are no entries in the section.

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

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

end of thread, other threads:[~2018-10-19 22:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 13:02 [Bug tools/23755] New: Multiple floating point exception in findtextrel.c in eu-findtextrel biniary of elfutils-v.0174 wcventure at 126 dot com
2018-10-10 13:03 ` [Bug tools/23755] " wcventure at 126 dot com
2018-10-10 13:04 ` wcventure at 126 dot com
2018-10-10 16:09 ` wcventure at 126 dot com
2018-10-14 15:01 ` mark at klomp dot org
2018-10-14 16:22 ` wcventure at 126 dot com
2018-10-19 22:27 ` 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).