From nobody Tue Apr 16 02:34:50 2024 X-Original-To: dev-commits-src-branches@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 4VJSmq0crmz5Hb8l; Tue, 16 Apr 2024 02:34:51 +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 4VJSmp52v4z4HqD; Tue, 16 Apr 2024 02:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713234890; 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=rGrs7ecFDdB5jffnqAKzFFAhh3Iijyp2l/JVSfXipCY=; b=si4u3g43QKtkqgMnZvnApThGMsRYKjzU7OPDNzP+QgQkd2M+xnrSW+CBLNPnENwTdVYd/X NhqPLZZAXQw3PQY30dmh5aFXtVuLpkaP1DWH/S+EMlqXb1J/YYUF1W/609crehqL1vF2r7 Nt8rU/oiSyalOsocMosixX/uulQTLs5rjzsjq1bX+jC2FR20bVs+7jbESC8eh5O1OyXBzQ TbOoCmer6Hvebskeh10g46acVzVvnpW3vcTFevLycuJ5KZuSwsw+eknUTuZtKPkFR0srzG JsPpk+BhYbDZIlt5zEKM3jw6F8HIkdC2Wl011i30Ua52ASLduDNyEAOLSKz8rQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713234890; a=rsa-sha256; cv=none; b=vB5vJM88ejSb4GZPSaQHttYf7l/e5dj7/xrxgT2TVu+3hLSMc5jFqMucJvTwjHFXuI903H begUp3zooKXAxDBVpDCpmSaLHctzZPnUfKy7DvgnhzjFHZQrZfOql2gGSNXU/DBPa0U0Jt cSXuZ0VUSSpMYeERjtUdzhmSe+3VvBbdLV7SrrikgPA5izyQf4a9be2dTpOuCHrMrRhSGX +SQYv95/LJcVW+NdhTGm9BDEAO/exp7qjuG/Z9jaUFdPEqq7lK7p6xm6WTkE5ReXMQ52gR /eOoFNrOUaKcCQNG1/G9QU/WO4MNjnO7aq3YoHXK8TYSnOFF2+hgg+yeYQKXPg== 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=1713234890; 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=rGrs7ecFDdB5jffnqAKzFFAhh3Iijyp2l/JVSfXipCY=; b=kUk/AJFfSUCzZuSA/9s6ubCdzXuWVPD7Jj2Ops4ePLEFsz6oA6b44wOTz+jkbXuYPrAfbK TxVUI4vKXlYw66INF3+rUEimAeWIpLBI+0bU3+vRjBmWoIxTGfymsZeulH+GTgfiguswz0 7PPNJqDW+84IvZPya85GsjTvVEEY7zCXSDSgDwCd3sHiWmOt4t7L+UBwCD+IrmEZ2ymwuN 7O71/yAoeTXVJWM0RvRzpMIXljzec2pvLOk2VCgS/67qVC3aqeIfD7oy/YOgHpn2YpMTRM J0T/uADSB4IroOciWN1S38yxCiy9P1qaiY94F/1+pzlcR2FdyZnD/wNYIGiI3g== 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 4VJSmp4gG6zQ65; Tue, 16 Apr 2024 02:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43G2YoCE037866; Tue, 16 Apr 2024 02:34:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43G2Yo5E037863; Tue, 16 Apr 2024 02:34:50 GMT (envelope-from git) Date: Tue, 16 Apr 2024 02:34:50 GMT Message-Id: <202404160234.43G2Yo5E037863@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 49028a1db2de - stable/14 - pmbr: Only load the first 545k rather than error out List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 49028a1db2de089482d203d5792f2abe7dc1449e Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=49028a1db2de089482d203d5792f2abe7dc1449e commit 49028a1db2de089482d203d5792f2abe7dc1449e Author: Warner Losh AuthorDate: 2023-11-27 22:40:40 +0000 Commit: Warner Losh CommitDate: 2024-04-16 02:32:05 +0000 pmbr: Only load the first 545k rather than error out It would be nice to have larger boot partitions for ESPs to live in one day. It's trivial to carve out 5M 10M or 200M when provisioning, but logistical issues may make it hard to do it after the fact. So only warn when the partition is > 545k. If we ever grow the boot loader larger than that, then it will be responsible for loading the rest anyway. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D42774 (cherry picked from commit c596126a5d3d2ee015ee6807b4041efa5b9d9b07) --- stand/i386/pmbr/pmbr.S | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/stand/i386/pmbr/pmbr.S b/stand/i386/pmbr/pmbr.S index c61acbe261bd..60b26df15720 100644 --- a/stand/i386/pmbr/pmbr.S +++ b/stand/i386/pmbr/pmbr.S @@ -155,8 +155,10 @@ next_boot: addl $1,(%si) # Next LBA mov %es,%ax # Adjust segment for next addw $SECSIZE/16,%ax # sector cmp $0x9000,%ax # Don't load past 0x90000, - jae err_big # 545k should be enough for - mov %ax,%es # any boot code. :) + jb sz_ok # 545k should be enough for + call err_big # any boot code, but warn + mov $0x9000-SECSIZE/16,%ax # and truncate +sz_ok: mov %ax,%es jmp load_boot # # Move to the next partition. If we walk off the end of the sector, load @@ -203,17 +205,21 @@ getdrvparams: # # Various error message entry points. # -err_big: movw $msg_big,%si # "Boot loader too - jmp putstr # large" +err_big: movw $msg_big,%si # "Truncated + call putstr # to 545k" + ret err_pt: movw $msg_pt,%si # "Invalid partition - jmp putstr # table" + call putstr # table" +err_pt.1: jmp err_pt.1 # Await reset err_rd: movw $msg_rd,%si # "I/O error loading - jmp putstr # boot loader" + call putstr # boot loader" + jmp err_pt.1 err_noboot: movw $msg_noboot,%si # "Missing boot - jmp putstr # loader" + call putstr # loader" + jmp err_pt.1 # # Output an ASCIZ string to the console via the BIOS. # @@ -223,9 +229,9 @@ putstr.0: movw $0x7,%bx # Page:attribute putstr: lodsb # Get character testb %al,%al # End of string? jnz putstr.0 # No -putstr.1: jmp putstr.1 # Await reset + ret -msg_big: .asciz "Boot loader too large" +msg_big: .asciz "Loaded only 545k" msg_pt: .asciz "Invalid partition table" msg_rd: .asciz "I/O error loading boot loader" msg_noboot: .asciz "Missing boot loader"