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 libelf/28666] memmove() reads out-of-range in elf32_xlatetom
Date: Tue, 07 Dec 2021 14:14:11 +0000	[thread overview]
Message-ID: <bug-28666-10460-b0MsCA07Mz@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28666-10460@http.sourceware.org/bugzilla/>

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

Evgeny Vereshchagin <evvers at ya dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |evvers at ya dot ru

--- Comment #1 from Evgeny Vereshchagin <evvers at ya dot ru> ---
FWIW There are a lot of moving parts there so in
https://github.com/google/oss-fuzz/pull/6944 I tried to make it easier to
reproduce bugs found by the fuzz target without Docker used by the oss-fuzz
toolchain. To that end I added a comment where I tried to explain how to build
it manually with clang and the build dependencies of elfutils:
https://github.com/google/oss-fuzz/blob/5f83a8b6811eaa6b1a0aa574e095ed0def8a0ce3/projects/elfutils/build.sh#L18-L36.

Apart from that I'm pretty sure all the bugs that can be found by the fuzz
target (in its current form at least) can be triggered with `./src/stack --core
...` built with ASan/UBsan or under Valgrind so this particular issue can be
triggered by running something like
```
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" 
./src/stack --core ../poc1
AddressSanitizer:DEADLYSIGNAL
=================================================================
==52660==ERROR: AddressSanitizer: SEGV on unknown address 0x7fd5b4e5d000 (pc
0x7fd5b8a86368 bp 0x7fff4773cb50 sp 0x7fff4773cb18 T0)
==52660==The signal is caused by a READ memory access.
    #0 0x7fd5b8a86368 in __sanitizer::internal_memmove(void*, void const*,
unsigned long) (/lib64/libasan.so.6+0xc5368)
    #1 0x7fd5b898aa42 in memmove /usr/include/bits/string_fortified.h:36
    #2 0x7fd5b898aa42 in elf32_xlatetom
/home/vagrant/elfutils/libelf/elf32_xlatetom.c:96
    #3 0x7fd5b88c285b in dwfl_link_map_report
/home/vagrant/elfutils/libdwfl/link_map.c:895
    #4 0x7fd5b88c7877 in _new.dwfl_core_file_report
/home/vagrant/elfutils/libdwfl/core-file.c:548
    #5 0x4037b8 in parse_opt /home/vagrant/elfutils/src/stack.c:595
    #6 0x7fd5b84bef81 in __argp_parse (/lib64/libc.so.6+0x10cf81)
    #7 0x404b7d in main /home/vagrant/elfutils/src/stack.c:695
    #8 0x7fd5b83d9b74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
    #9 0x40256d in _start (/home/vagrant/elfutils/src/stack+0x40256d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib64/libasan.so.6+0xc5368) in
__sanitizer::internal_memmove(void*, void const*, unsigned long)
==52660==ABORTING
```

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

  reply	other threads:[~2021-12-07 14:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 12:53 [Bug libelf/28666] New: " netfirewall at gmail dot com
2021-12-07 14:14 ` evvers at ya dot ru [this message]
2021-12-07 14:50 ` [Bug libelf/28666] " mark at klomp dot org
2021-12-08 13:45 ` mark at klomp dot org
2021-12-08 17:25 ` evvers at ya dot ru
2021-12-08 20:28 ` evvers at ya dot ru
2021-12-08 20:37 ` evvers at ya dot ru
2021-12-09 19:08 ` mark at klomp dot org
2021-12-09 19:22 ` evvers at ya dot ru
2021-12-09 20:23 ` 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-28666-10460-b0MsCA07Mz@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).