From nobody Fri Mar 22 13:59:56 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V1P8r6YVPz5F0rY for ; Fri, 22 Mar 2024 13:59:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V1P8r3VgCz4FQC for ; Fri, 22 Mar 2024 13:59:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711115996; a=rsa-sha256; cv=none; b=l/kpcww1qn82ZOR0CjPLOkBISh5mgmLEA1/dowjlmUyfYW7qqSADjg6PeMDHXohrbuPck6 E9CIWopm9du+oBwexr6vPp0J3+wdmgRgaUXy0JUZkGF1QwujQHeSi3bDdbPLdGWg6460k3 wsE02TD/xX5TI1QPdvW2jfZ1fa5mx4c8vw9RzhJIk1Sn7kICQGkOxpOKDDoq9uahL8FPGP QXctEi8wt3GmoADoVFJJ6/MSq+QE6DeN65od9kYKFhmBErY8D3L0/YUaOKzuvvlgJvkRgl wS9hspXlW9PDPxQLMXVSJRU/SMIZCRjFu/Y0A+H9IgPftpqwY3Fl1FPV75Z/cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711115996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yoxQ2WvtCOpsYMXN5dWSOpZ8j+KdBG7yX/r7wDd95tE=; b=Pb9xhk7Zt/jo3sTjkZz8ruMyAm9v+D9mJCMiTbTpZmgdUAowjhrFyaTfFYynvspnqNvJiP Sbry+34eZQ1SMD5HJEgH9mha69FzAZyAx7yKkMQuLOG58XtL1r5P2Zau2G+rj5fgPI5lkR 3+/J8QyDaxfvuaGcxrvGd5RjpAimQJFTq2v4CEzUpGgia1gBJe+HxBPvbqVLVUcKrfyBkN 4T2n+tLibj0+bv08TLdmjLkKx5NXn1Ef4nitaHbMCoJAARebl7PFEtVFfVpfnqKJT1Br9I ZoOjfwyseCfpIXga6ImZIVRQpgBoCo7GyjfjBl/OxpCZNNdKByhql+2flLcRLw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V1P8r305Xz1LyT for ; Fri, 22 Mar 2024 13:59:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 42MDxuNp023065 for ; Fri, 22 Mar 2024 13:59:56 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 42MDxuje023064 for bugs@FreeBSD.org; Fri, 22 Mar 2024 13:59:56 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 277885] llvm-objdump's printDynamicSection() out-of-bounds read Date: Fri, 22 Mar 2024 13:59:56 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277885 Bug ID: 277885 Summary: llvm-objdump's printDynamicSection() out-of-bounds read Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Created attachment 249399 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D249399&action= =3Dedit broken ELF file that causes an out-of-bounds read in llvm-objdump's printDynamicSection() This code in llvm-project/llvm/tools/llvm-objdump/ELFDump.cpp printDynamicSection() forms a pointer using Dyn.d_un_dval, which it obtains from the ELF file, without a sanity check: const char *Data =3D StrTabOrErr.get().data(); outs() << (Data + Dyn.d_un.d_val) << "\n"; I've attached a demonstration: # uname -a FreeBSD xxx 15.0-CURRENT FreeBSD 15.0-CURRENT #19 main-n268743-a58813fd701e: Sat Mar 9 07:18:21 AST 2024=20=20=20=20 root@xxx:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 # llvm-objdump --version LLVM (http://llvm.org/): LLVM version 17.0.6 Optimized build with assertions. ... # llvm-objdump -x objdump10a.exe ... Dynamic Section: NEEDED PLEASE submit a bug report to https://bugs.freebsd.org/submi= t/ and include the crash backtrace. Stack dump: 0. Program arguments: llvm-objdump -x objdump10a.exe #0 0x0000000001230c41 PrintStackTrace /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:602:13 #1 0x000000000122f0b5 RunSignalHandlers /usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:105:18 #2 0x0000000001231365 SignalHandler /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3 #3 0x00000008267d55ff handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0= :3 #4 0x00000008267d4bbb thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:244:1 #5 0x0000000822def2d3 ([vdso]+0x2d3) #6 0x0000000828b3a7eb /usr/src/lib/libc/amd64/string/strlen.S:95:0 #7 0x0000000000df28c9 __constexpr_strlen /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__string/constexpr_c_fu= nctions.h:49:10 #8 0x0000000000df28c9 length /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__string/char_traits.h:= 222:14 #9 0x0000000000df28c9 StringRef /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h:90:33 #10 0x0000000000df28c9 operator<< /usr/src/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h:244:29 #11 0x0000000000df28c9 printDynamicSection /usr/src/contrib/llvm-project/llvm/tools/llvm-objdump/ELFDump.cpp:233:16 #12 0x0000000000df28c9 printPrivateHeaders /usr/src/contrib/llvm-project/llvm/tools/llvm-objdump/ELFDump.cpp:431:3 #13 0x0000000000e6a13c dumpObject /usr/src/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp:2815= :7 #14 0x0000000000e654b0 dumpInput /usr/src/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp:0:5 #15 0x0000000000e654b0 for_each, std::__1::allocator > *>, void (*)(llvm::StringRef)> /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__algorithm/for_each.h:= 26:5 #16 0x0000000000e654b0 for_each, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > &, void (*)(llvm::StringRef)> /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1731:10 #17 0x0000000000e654b0 main /usr/src/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp:3248= :3 #18 0x0000000828a660aa __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:15= 7:2 Segmentation fault (core dumped) --=20 You are receiving this mail because: You are the assignee for the bug.=