* [Bug libdw/28657] New: UBSan seems to report a divison-by-zero in dwfl_link_map_report
@ 2021-12-06 12:46 evvers at ya dot ru
2021-12-06 12:50 ` [Bug libdw/28657] " evvers at ya dot ru
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: evvers at ya dot ru @ 2021-12-06 12:46 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28657
Bug ID: 28657
Summary: UBSan seems to report a divison-by-zero in
dwfl_link_map_report
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 13824
--> https://sourceware.org/bugzilla/attachment.cgi?id=13824&action=edit
File triggering a "division-by-zero"
One of systemd fuzz target run under UBSan discovered a "divison-by-zero". It
can be reproduced by building the master branch of the elfutils repository with
UBSan and passing the attachment to `./src/stack`
```
$ git describe
elfutils-0.186-7-g99782bd2
autoreconf -i -f
./configure --enable-maintainer-mode CFLAGS='-g -O1 -fno-omit-frame-pointer'
--enable-sanitize-undefined CXXFLAGS='-g -O1 -fno-omit-frame-pointer'
make -j$(nproc) V=1
LD_PRELOAD="./libelf/libelf.so ./libdw/libdw.so"
UBSAN_OPTIONS=print_stacktrace=1:print_summary=1 ./src/stack --core
../oss-fuzz-41574
link_map.c:873:12: runtime error: division by zero
#0 0x7f93972cf29a in dwfl_link_map_report
/home/vagrant/elfutils/libdwfl/link_map.c:873
#1 0x7f93972d25c7 in _new.dwfl_core_file_report
/home/vagrant/elfutils/libdwfl/core-file.c:548
#2 0x402b0f in parse_opt /home/vagrant/elfutils/src/stack.c:595
#3 0x7f939654df81 in __argp_parse (/lib64/libc.so.6+0x10cf81)
#4 0x403d98 in main /home/vagrant/elfutils/src/stack.c:695
#5 0x7f9396468b74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
#6 0x4024cd in _start (/home/vagrant/elfutils/src/stack+0x4024cd)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior link_map.c:873:12 in
```
It was also reported in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41574
```
Running:
/mnt/scratch0/clusterfuzz/bot/inputs/fuzzer-testcases/crash-747fcf4f5bf93741e8fc31e9cbb44a70865e4c07
link_map.c:873:12: runtime error: division by zero
#0 0x51cae6 in dwfl_link_map_report /src/elfutils/libdwfl/link_map.c:873:12
#1 0x4b868b in dwfl_core_file_report
/src/elfutils/libdwfl/core-file.c:548:16
#2 0x4b363e in LLVMFuzzerTestOneInput /src/fuzz-dwfl-core.c:52:6
#3 0x43f1b3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*,
unsigned long) cxa_noexception.cpp:0
#4 0x42aac2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned
long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
#5 0x43058a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char
const*, unsigned long)) cxa_noexception.cpp:0
#6 0x4594b2 in main
/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#7 0x7f2bedb160b2 in __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/libc-start.c:308:16
#8 0x407d4d in _start
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior link_map.c:873:12 in
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libdw/28657] UBSan seems to report a divison-by-zero in dwfl_link_map_report
2021-12-06 12:46 [Bug libdw/28657] New: UBSan seems to report a divison-by-zero in dwfl_link_map_report evvers at ya dot ru
@ 2021-12-06 12:50 ` evvers at ya dot ru
2021-12-08 19:53 ` mark at klomp dot org
2021-12-09 19:09 ` mark at klomp dot org
2 siblings, 0 replies; 4+ messages in thread
From: evvers at ya dot ru @ 2021-12-06 12:50 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28657
--- Comment #1 from Evgeny Vereshchagin <evvers at ya dot ru> ---
*** Bug 28658 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libdw/28657] UBSan seems to report a divison-by-zero in dwfl_link_map_report
2021-12-06 12:46 [Bug libdw/28657] New: UBSan seems to report a divison-by-zero in dwfl_link_map_report evvers at ya dot ru
2021-12-06 12:50 ` [Bug libdw/28657] " evvers at ya dot ru
@ 2021-12-08 19:53 ` mark at klomp dot org
2021-12-09 19:09 ` mark at klomp dot org
2 siblings, 0 replies; 4+ messages in thread
From: mark at klomp dot org @ 2021-12-08 19:53 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28657
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org
Ever confirmed|0 |1
Last reconfirmed| |2021-12-08
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at sourceware dot org |mark at klomp dot org
--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
Proposed patch:
https://sourceware.org/pipermail/elfutils-devel/2021q4/004469.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libdw/28657] UBSan seems to report a divison-by-zero in dwfl_link_map_report
2021-12-06 12:46 [Bug libdw/28657] New: UBSan seems to report a divison-by-zero in dwfl_link_map_report evvers at ya dot ru
2021-12-06 12:50 ` [Bug libdw/28657] " evvers at ya dot ru
2021-12-08 19:53 ` mark at klomp dot org
@ 2021-12-09 19:09 ` mark at klomp dot org
2 siblings, 0 replies; 4+ messages in thread
From: mark at klomp dot org @ 2021-12-09 19:09 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28657
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
commit c21c606602e1160c19d01e2836e23aa1a9e13432
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Dec 8 20:48:45 2021 +0100
libdwfl: Make sure we know the phdr entry size before searching phdrs.
Without the program header entry size we cannot search through the
phdrs.
https://sourceware.org/bugzilla/show_bug.cgi?id=28657
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] 4+ messages in thread
end of thread, other threads:[~2021-12-09 19:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 12:46 [Bug libdw/28657] New: UBSan seems to report a divison-by-zero in dwfl_link_map_report evvers at ya dot ru
2021-12-06 12:50 ` [Bug libdw/28657] " evvers at ya dot ru
2021-12-08 19:53 ` mark at klomp dot org
2021-12-09 19:09 ` 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).