From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB96D3858D28; Tue, 7 Dec 2021 14:14:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB96D3858D28 From: "evvers at ya dot ru" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: libelf X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: evvers at ya dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2021 14:14:11 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28666 Evgeny Vereshchagin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |evvers at ya dot ru --- Comment #1 from Evgeny Vereshchagin --- 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 bu= ild it manually with clang and the build dependencies of elfutils: https://github.com/google/oss-fuzz/blob/5f83a8b6811eaa6b1a0aa574e095ed0def8= a0ce3/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=3D'-g -O1 -fno-omit-frame-point= er -fsanitize=3Daddress' CXXFLAGS=3D'-g -O1 -fno-omit-frame-pointer -fsanitize=3Daddress' ASAN_OPTIONS=3Ddetect_leaks=3D0 make -j$(nproc) V=3D1 $ LD_PRELOAD=3D"/lib64/libasan.so.6 ./libelf/libelf.so ./libdw/libdw.so"=20 ./src/stack --core ../poc1 AddressSanitizer:DEADLYSIGNAL =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D52660=3D=3DERROR: AddressSanitizer: SEGV on unknown address 0x7fd5b4e= 5d000 (pc 0x7fd5b8a86368 bp 0x7fff4773cb50 sp 0x7fff4773cb18 T0) =3D=3D52660=3D=3DThe 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) =3D=3D52660=3D=3DABORTING ``` --=20 You are receiving this mail because: You are on the CC list for the bug.=