From nobody Wed Mar 2 21:57:14 2022 X-Original-To: dev-commits-src-all@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 2515619E068E; Wed, 2 Mar 2022 21:57:15 +0000 (UTC) (envelope-from git@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 4K87JC0C8Yz3K0Y; Wed, 2 Mar 2022 21:57:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258235; 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=zSRcOr5EoFthbigQZjGYYqb21mbNFWnDoZakYWzrBSo=; b=twPpGqhT5IAffuv53Ze1VXTN+PO2+HnaoH50BXEuKAXW90qkZyPC+Nq8Cq+see9t5VgsCx i7T+e3i0u/qTpLJD7QXzhQ1XIQphkw41YUjUHLUxnyb8lp9xEh8CQLF78mrh10NjKPAtiP Z3rZNlovmTl2GBpEAr8Nl48CK/WIZywIs5tWJJjDpDK5aVZP4YwcrwrGcHO0AaThX4eeel Ep2xu82nqi5odz/XpVrJny+eDep2X6VS6L7qRg4ageH9BfuOLToPx3LZu3IdbJ+33O0pz6 I0RpAuuld6+PLphdx+KqFf9J3vph/TmOKxoCQM7l5Wgyi9hAk1hOzoJpZrTF+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 CCC6A37C3; Wed, 2 Mar 2022 21:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 222LvEw0064962; Wed, 2 Mar 2022 21:57:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222LvEtC064961; Wed, 2 Mar 2022 21:57:14 GMT (envelope-from git) Date: Wed, 2 Mar 2022 21:57:14 GMT Message-Id: <202203022157.222LvEtC064961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric van Gyzen Subject: git: f3629ca2f555 - stable/13 - uefisign: handle empty sections List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f3629ca2f5557a5e2897dda74c6e362600916103 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258235; 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=zSRcOr5EoFthbigQZjGYYqb21mbNFWnDoZakYWzrBSo=; b=IX25kf3HaCFXGFkJbGac4C9Zm+2oeVa4Ka4Yc9d/x6OEkBw3+30vfc5pPhiPyAZuZA+Lq2 YnTUBVKJTgiW/jsfBe7VPwdgces/PumEoiUS8+25EY7CTEL7JLfM/kAD1OT5kG4NaGA4dD 7sJ+JUJnRwGUu5Bmus80LwBFBjyEVssQRraSV2rEp3p4um80xNLWKqw03mW2hBLd8nVFCL 0/at9VurTbugXdDeCXcQ5f3aqpvPCYokutdTUVPtG4hnZLX7z7CDZQgOxAPk76oZQlcNUP lajTXhjkI7w7kWjLkXnvgWSZxyYCjSeJG5FDBVk5n2I3mGEbLF8HQPGYzPLZ9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646258235; a=rsa-sha256; cv=none; b=CyIrkPZvFEaBfvbf9U/awbudZvOFA/Xa3t6x+RNNp9lDuqgu6RN09VLbLK7XH6Hvkt2Kd5 7M3+tB7k8sR6e1baFx26gihJCiSfuDAnAuB+ZE2+oOnbvA+PpkTeL/X9FpsNUOWbYjPCw6 Eu53EZSVMDU/D2tdkIyEVN/IxN8Gv/WiIiLKc3azUpJtublF/Pgljh4nxyAjg4ndaz/KmI YMWh1t/fVssjHv5LNoLNoFWJo7doZLUh0uf47ocN/dw4pg7WlFXw08MlyVxnctuexfVUIV b0m4/bRjqRBiDykNQUMs3y9T6KLpzOEqa7kfTSnoPdB8OFj4jIhHTL+QBqSVeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=f3629ca2f5557a5e2897dda74c6e362600916103 commit f3629ca2f5557a5e2897dda74c6e362600916103 Author: Eric van Gyzen AuthorDate: 2021-04-06 14:42:20 +0000 Commit: Eric van Gyzen CommitDate: 2022-03-02 21:56:30 +0000 uefisign: handle empty sections loader.efi has an empty set_Xfic section. Handle it correctly. ``` Sections: Idx Name Size VMA LMA File off Algn [...] 3 set_Xcom 00000168 00000000000d4000 00000000000d4000 000d0e00 2**2 CONTENTS, ALLOC, LOAD, DATA 4 set_Xfic 00000000 00000000000d4168 00000000000d4168 00000000 2**2 ALLOC, LOAD, DATA 5 .sdata 00000448 00000000000d5000 00000000000d5000 000d1000 2**2 CONTENTS, ALLOC, LOAD, DATA [...] ``` Reviewed by: trasz, dab Reported by: andy.y.liu@dell.com Tested by: andy.y.liu@dell.com MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29606 (cherry picked from commit 12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28) --- usr.sbin/uefisign/pe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/uefisign/pe.c b/usr.sbin/uefisign/pe.c index 9f010e5d8a46..6459321441d8 100644 --- a/usr.sbin/uefisign/pe.c +++ b/usr.sbin/uefisign/pe.c @@ -244,7 +244,8 @@ parse_section_table(struct executable *x, off_t off, int number_of_sections) x->x_nsections = number_of_sections; for (i = 0; i < number_of_sections; i++) { - if (psh->psh_pointer_to_raw_data < x->x_headers_len) + if (psh->psh_size_of_raw_data > 0 && + psh->psh_pointer_to_raw_data < x->x_headers_len) errx(1, "section points inside the headers"); range_check(x, psh->psh_pointer_to_raw_data,