public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "evvers at ya dot ru" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libdw/28654] New: There seems to be an infinite loop somewhere in dwfl_segment_report_module
Date: Mon, 06 Dec 2021 11:39:31 +0000	[thread overview]
Message-ID: <bug-28654-10460@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 28654
           Summary: There seems to be an infinite loop somewhere in
                    dwfl_segment_report_module
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: evvers at ya dot ru
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 13822
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13822&action=edit
file triggering an infinite loop in dwfl_segment_report_module

One of systemd fuzz targets discovered what seems to be an infinite loop in
dwfl_segment_report_module. It can be reproduced by building the master branch
of the elfutils repository and passing the attachment to `./src/stack`:
```
$ git describe
elfutils-0.186-7-g99782bd2
```
```
autoreconf -i -f
./configure --enable-maintainer-mode
make -j$(nproc) V=1
LD_PRELOAD="./libelf/libelf.so ./libdw/libdw.so" ./src/stack --core
oss-fuzz-41572
```

According to `eu-stack` it's in dwfl_segment_report_module
```
#0  0x00007fa48b3eecf3 dwfl_segment_report_module
#1  0x00007fa48b3f2c88 dwfl_core_file_report@@ELFUTILS_0.158
#2  0x0000000000402ec7 parse_opt
#3  0x00007fa48b0abf82 argp_parse
#4  0x00000000004024eb main
#5  0x00007fa48afc6b75 __libc_start_main
#6  0x000000000040272e _start
```

It was also reported in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41572
```
ALARM: working on the last Unit for 61 seconds
       and the timeout value is 60 (use -timeout=N to change)
==782== ERROR: libFuzzer: timeout after 61 seconds
    #0 0x52fdb1 in __sanitizer_print_stack_trace
/src/llvm-project/compiler-rt/lib/asan/asan_stack.cpp:87:3
    #1 0x4707e8 in fuzzer::PrintStackTrace() cxa_noexception.cpp:0
    #2 0x455679 in fuzzer::Fuzzer::AlarmCallback() cxa_noexception.cpp:0
    #3 0x7ff8fd7473bf in libpthread.so.0
    #4 0x46e23c in HandleCmp<unsigned long>
/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:390:31
    #5 0x46e23c in __sanitizer_cov_trace_cmp8
/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:483:15
    #6 0x5f6edb in dwfl_segment_report_module
/src/elfutils/libdwfl/dwfl_segment_report_module.c:546:29
    #7 0x567135 in dwfl_core_file_report
/src/elfutils/libdwfl/core-file.c:559:17
    #8 0x55f280 in LLVMFuzzerTestOneInput /src/fuzz-dwfl-core.c:52:6
    #9 0x456ca3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*,
unsigned long) cxa_noexception.cpp:0
    #10 0x4425b2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned
long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
    #11 0x44807a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char
const*, unsigned long)) cxa_noexception.cpp:0
    #12 0x470fa2 in main
/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #13 0x7ff8fd53b0b2 in __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/libc-start.c:308:16
    #14 0x41f83d in _start
SUMMARY: libFuzzer: timeout
```

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

             reply	other threads:[~2021-12-06 11:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 11:39 evvers at ya dot ru [this message]
2021-12-08 17:04 ` [Bug libdw/28654] " mark at klomp dot org
2021-12-08 18:11 ` evvers at ya dot ru
2021-12-16 21:55 ` mark at klomp dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28654-10460@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).