* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
@ 2021-12-08 20:11 ` mark at klomp dot org
2021-12-08 20:25 ` evvers at ya dot ru
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2021-12-08 20:11 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
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> ---
Valgrind also complains about this.
But this seems to be resolved by the proposed patch for PR28657.
https://sourceware.org/bugzilla/show_bug.cgi?id=28657
Which makes sense since we aren't trying to deal with a zero phdr size.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
2021-12-08 20:11 ` [Bug libdw/28660] " mark at klomp dot org
@ 2021-12-08 20:25 ` evvers at ya dot ru
2021-12-09 21:09 ` evvers at ya dot ru
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: evvers at ya dot ru @ 2021-12-08 20:25 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
--- Comment #2 from Evgeny Vereshchagin <evvers at ya dot ru> ---
As far as I can see both issues are gone with that patch applied. Thanks!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
2021-12-08 20:11 ` [Bug libdw/28660] " mark at klomp dot org
2021-12-08 20:25 ` evvers at ya dot ru
@ 2021-12-09 21:09 ` evvers at ya dot ru
2021-12-09 21:20 ` evvers at ya dot ru
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: evvers at ya dot ru @ 2021-12-09 21:09 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
--- Comment #3 from Evgeny Vereshchagin <evvers at ya dot ru> ---
Looks like it keeps popping up with all the patches applied
```
0a2c8345 libdwfl: Don't try to convert too many dyns in dwfl_link_map_report
ea8ce550 libdwfl: Don't install an Elf handle in a Dwfl_Module twice
906e0ca5 libdwfl: Don't trust e_shentsize in dwfl_segment_report_module
a5dc98be libdwfl: Make sure we know the phdr entry size before searching phdrs.
8ae296dc libdwfl: Add overflow check while iterating in
dwfl_segment_report_module
c0dd1c35 libdwfl: Don't try to convert too many bytes in dwfl_link_map_report
5ba884a5 configure: Add --enable-sanitize-address
```
I'll attach a file triggering it once the fuzz target runs into it again
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
` (2 preceding siblings ...)
2021-12-09 21:09 ` evvers at ya dot ru
@ 2021-12-09 21:20 ` evvers at ya dot ru
2021-12-15 23:44 ` mark at klomp dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: evvers at ya dot ru @ 2021-12-09 21:20 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
--- Comment #4 from Evgeny Vereshchagin <evvers at ya dot ru> ---
Created attachment 13842
--> https://sourceware.org/bugzilla/attachment.cgi?id=13842&action=edit
File triggering an "invalid read"
I've just attached a file triggering the issue:
```
autoreconf -i -f
./configure --enable-maintainer-mode
make -j$(nproc) V=1
DEBUGINFOD_URLS= LD_PRELOAD="./libelf/libelf.so ./libdw/libdw.so" valgrind
--leak-check=full ./src/stack --core
../crash-e8e47de6a28b1be30e3a7e2f92b7c9e4f4fffa9d
==87229== Memcheck, a memory error detector
==87229== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==87229== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==87229== Command: ./src/stack --core
../crash-e8e47de6a28b1be30e3a7e2f92b7c9e4f4fffa9d
==87229==
==87229== Invalid read of size 4
==87229== at 0x48C783F: dwfl_link_map_report (link_map.c:917)
==87229== by 0x48C8DC5: dwfl_core_file_report@@ELFUTILS_0.158
(core-file.c:548)
==87229== by 0x402EC6: parse_opt (stack.c:595)
==87229== by 0x4C4D591: argp_parse (in /usr/lib64/libc.so.6)
==87229== by 0x4024EA: main (stack.c:695)
==87229== Address 0x5029ae0 is 0 bytes after a block of size 4,096 alloc'd
==87229== at 0x484186F: malloc (vg_replace_malloc.c:381)
==87229== by 0x48C7D6B: dwfl_link_map_report (link_map.c:891)
==87229== by 0x48C8DC5: dwfl_core_file_report@@ELFUTILS_0.158
(core-file.c:548)
==87229== by 0x402EC6: parse_opt (stack.c:595)
==87229== by 0x4C4D591: argp_parse (in /usr/lib64/libc.so.6)
==87229== by 0x4024EA: main (stack.c:695)
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
` (3 preceding siblings ...)
2021-12-09 21:20 ` evvers at ya dot ru
@ 2021-12-15 23:44 ` mark at klomp dot org
2021-12-16 0:53 ` evvers at ya dot ru
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2021-12-15 23:44 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at sourceware dot org |mark at klomp dot org
Last reconfirmed| |2021-12-15
Ever confirmed|0 |1
--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
Proposed some more sanity checks:
https://sourceware.org/pipermail/elfutils-devel/2021q4/004523.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
` (4 preceding siblings ...)
2021-12-15 23:44 ` mark at klomp dot org
@ 2021-12-16 0:53 ` evvers at ya dot ru
2021-12-16 1:48 ` evvers at ya dot ru
2021-12-16 21:36 ` mark at klomp dot org
7 siblings, 0 replies; 9+ messages in thread
From: evvers at ya dot ru @ 2021-12-16 0:53 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
--- Comment #6 from Evgeny Vereshchagin <evvers at ya dot ru> ---
Thanks! I can confirm that the issue is gone.
I tested it in https://github.com/evverx/elfutils/pull/53 by adding that file
to the testsuite in
https://github.com/evverx/elfutils/pull/53/commits/38c241bf6269ab5a1dd93b606e11001dc3b6c1f4.
I also ran the fuzzer for about 10 minutes.
Interestingly, something started to trigger unreproducible MSan crashes but I'm
inclined to say it was probably a fluke.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
` (5 preceding siblings ...)
2021-12-16 0:53 ` evvers at ya dot ru
@ 2021-12-16 1:48 ` evvers at ya dot ru
2021-12-16 21:36 ` mark at klomp dot org
7 siblings, 0 replies; 9+ messages in thread
From: evvers at ya dot ru @ 2021-12-16 1:48 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
--- Comment #7 from Evgeny Vereshchagin <evvers at ya dot ru> ---
> Interestingly, something started to trigger unreproducible MSan crashes but
> I'm inclined to say it was probably a fluke.
It wasn't a glitch. The file I added to the test suite was also automatically
added to the seed corpus, which in turn triggered new code paths and led to
large allocations I reported elsewhere. So it doesn't have anything to do with
this issue and the patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libdw/28660] ASan seems to complain about a "heap-buffer-overflow"
2021-12-06 13:16 [Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow" evvers at ya dot ru
` (6 preceding siblings ...)
2021-12-16 1:48 ` evvers at ya dot ru
@ 2021-12-16 21:36 ` mark at klomp dot org
7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2021-12-16 21:36 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Mark Wielaard <mark at klomp dot org> ---
Thanks for testing. Pushed as:
commit 3c9b69161b842708b4ef2f4e0f0b3ad1812798c2
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Dec 16 00:29:22 2021 +0100
libdwfl: Make sure phent is sane and there is at least one phdr
dwfl_link_map_report can only handle program headers that are the
correct (32 or 64 bit) size. The buffer read in needs to contain room
for at least one Phdr.
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
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] 9+ messages in thread