[Bug libdw/28660] New: ASan seems to complain about a "heap-buffer-overflow"
evvers at ya dot ru
sourceware-bugzilla@sourceware.org
Mon Dec 6 13:16:03 GMT 2021
https://sourceware.org/bugzilla/show_bug.cgi?id=28660
Bug ID: 28660
Summary: ASan seems to complain about a "heap-buffer-overflow"
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 13826
--> https://sourceware.org/bugzilla/attachment.cgi?id=13826&action=edit
File triggering a heap-buffer-overflow
One of systemd fuzz targets triggered a "heap-buffer-overflow". It can be
reproduced by building the master branch of the elfutils repository with ASan
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
-fsanitize=address' CXXFLAGS='-g -O1 -fno-omit-frame-pointer
-fsanitize=address'
ASAN_OPTIONS=detect_leaks=0 make -j$(nproc) V=1
LD_PRELOAD="/lib64/libasan.so.6 ./libelf/libelf.so ./libdw/libdw.so"
UBSAN_OPTIONS=print_stacktrace=1:print_summary=1 ./src/stack --core
../oss-fuzz-41566
=================================================================
==85112==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x602000001b70 at pc 0x7f96b3109a31 bp 0x7ffebaf7f470 sp 0x7ffebaf7f468
READ of size 4 at 0x602000001b70 thread T0
#0 0x7f96b3109a30 in dwfl_link_map_report
/home/vagrant/elfutils/libdwfl/link_map.c:904
#1 0x7f96b310e877 in _new.dwfl_core_file_report
/home/vagrant/elfutils/libdwfl/core-file.c:548
#2 0x4037b8 in parse_opt /home/vagrant/elfutils/src/stack.c:595
#3 0x7f96b2d05f81 in __argp_parse (/lib64/libc.so.6+0x10cf81)
#4 0x404b7d in main /home/vagrant/elfutils/src/stack.c:695
#5 0x7f96b2c20b74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
#6 0x40256d in _start (/home/vagrant/elfutils/src/stack+0x40256d)
0x602000001b71 is located 0 bytes to the right of 1-byte region
[0x602000001b70,0x602000001b71)
allocated by thread T0 here:
#0 0x7f96b32b693f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
#1 0x7f96b31096c4 in dwfl_link_map_report
/home/vagrant/elfutils/libdwfl/link_map.c:879
#2 0x7f96b310e877 in _new.dwfl_core_file_report
/home/vagrant/elfutils/libdwfl/core-file.c:548
#3 0x4037b8 in parse_opt /home/vagrant/elfutils/src/stack.c:595
#4 0x7f96b2d05f81 in __argp_parse (/lib64/libc.so.6+0x10cf81)
#5 0x404b7d in main /home/vagrant/elfutils/src/stack.c:695
#6 0x7f96b2c20b74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
SUMMARY: AddressSanitizer: heap-buffer-overflow
/home/vagrant/elfutils/libdwfl/link_map.c:904 in dwfl_link_map_report
Shadow bytes around the buggy address:
0x0c047fff8310: fa fa 00 03 fa fa 00 04 fa fa fd fa fa fa fd fa
0x0c047fff8320: fa fa 00 03 fa fa 00 04 fa fa fd fa fa fa fd fa
0x0c047fff8330: fa fa 00 03 fa fa 00 04 fa fa fd fa fa fa fd fa
0x0c047fff8340: fa fa 00 03 fa fa 00 04 fa fa fd fa fa fa fd fa
0x0c047fff8350: fa fa 00 03 fa fa 00 04 fa fa fd fa fa fa fd fa
=>0x0c047fff8360: fa fa 00 03 fa fa 00 04 fa fa 00 04 fa fa[01]fa
0x0c047fff8370: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8390: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff83a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff83b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==85112==ABORTING
```
It was also reported in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41566
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Elfutils-devel
mailing list