From nobody Wed Oct 16 00:14:38 2024 X-Original-To: dev-commits-src-main@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 4XSs0b10JBz5ZCQJ; Wed, 16 Oct 2024 00:14:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSs0b0Tzcz46Rv; Wed, 16 Oct 2024 00:14:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729037679; 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=t8qGKoslB5SnCY6C2IYMTCLo6QVfJdPaiSI3USVB+rg=; b=FYR4T0gO1XwHGEAoiQ1wL/mWD1I0L0V3HtK4Rv0sksB2iFGgdhRVhW0PVpVTnA7KThcRwZ p0dJHME8+jRepPxsySVGoXfQ9ACfBDb2IGGC09SPUjPu8mZYfUzFf7GhnmKRPg/squ2+Im IkHJKObbMD/vPhwRmzBLDXZ9qe0idGKPtXXW7oa+3SPv3LJjvwIZCM2scx1WZtQBwz/ApX ukqUTNyqT+FTom3JG7RMJnCu5aaYEmg5L75a4GGIDqMVJ4CQ40ZpNKdhGx++99tB6zWuu2 7pxXmuh25nUTL4J/ezkgNLyd40w2w6kPE0LQ7GcnIDTvnWTUc4OGL1Vl8yxgkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729037679; 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=t8qGKoslB5SnCY6C2IYMTCLo6QVfJdPaiSI3USVB+rg=; b=L82faY6SRC4Q0kVrEIkP/PHMwqriHnfBZMtp8J3HgjPcgwUQtszObz8IHEJUZ9OPOqnR7r TBfGLo008pYfJT/uM2swf9H0bqC4UsHcoPNA9JWikRu/xlOfV5O1tALqiqoWo6Hd2xcizD 0OVm04FqNP+9+/GGVtl6gcjxZ1Cg/eL4yBoC92V1D9bgPng8qywzVEmnfzZo9ttWQKSx9E hexORWC8DfqRx6F0QVCFJ3b3Fd8YYJ+X6tdG0qzBVAN+GepWdK0U3l34EUi3Y9SvC5+0CQ G/t/79m52CiSPcWU6dbMrwGDNSjHFucMQ596V7aJotwxXJpjsfUNNqqJ+oPJPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729037679; a=rsa-sha256; cv=none; b=b9W1h13kfHJoiRkwBwZhaeahYJ8aY1Du6PJPW14CAGspaavE+BHu0+5ebmrR4aUI6330nl 2ckBIYGt4wzWmez7FhLv8D1XrEO8pE2HkQUEEB4dlO0v8KOVxHwoWHq1f7qpgP5UsWgwev fKmCoQuIxR2EXAWfVpuzxkl4noDhz5Lre4SiVqOf61Hm3sLwWGEIhry6Gr3Hb0XaI9erte mpu2KyEfjFiXNB+MdstB37YDTK9mjx8XMpy0KwIR5Yz1EiF+U3IqYU2A+W9qHrflNrp4Yq 8oqEMeG9EIzsbYT6VSYR1IHjIlDnKB5Et9A+f3IBwsjgGal9oz0Aknda7dc57A== 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 4XSs0b04xczj0D; Wed, 16 Oct 2024 00:14:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49G0EcCl026167; Wed, 16 Oct 2024 00:14:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49G0EcW3026164; Wed, 16 Oct 2024 00:14:38 GMT (envelope-from git) Date: Wed, 16 Oct 2024 00:14:38 GMT Message-Id: <202410160014.49G0EcW3026164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 2cbda736cea8 - main - gpart: Add warning when the start sector is too low. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 2cbda736cea8f82cfc5caab0f6099f0fbfe28537 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2cbda736cea8f82cfc5caab0f6099f0fbfe28537 commit 2cbda736cea8f82cfc5caab0f6099f0fbfe28537 Author: Warner Losh AuthorDate: 2024-10-16 00:03:03 +0000 Commit: Warner Losh CommitDate: 2024-10-16 00:15:16 +0000 gpart: Add warning when the start sector is too low. Add a warning if the starting sector is too low. The standard requires that at least 16k is reserved for the GPT Partition Array, but some tools produce GPT images with fewer than the required number of reserved sectors. PR: 274312 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42247 --- sys/geom/part/g_part_gpt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c index 022337bd6575..4733631c4b20 100644 --- a/sys/geom/part/g_part_gpt.c +++ b/sys/geom/part/g_part_gpt.c @@ -1045,6 +1045,20 @@ g_part_gpt_read(struct g_part_table *basetable, struct g_consumer *cp) g_free(sectbl); } + /* + * The reserved area preceeds the valid area for partitions. Warn when + * the lba_start doesn't meet the standard's minimum size for the gpt + * entry array. UEFI 2.10 section 5.3 specifies that the LBA must be 32 + * (for 512 byte sectors) or 6 (4k sectors) or larger. This is different + * than the number of valid entries in the GPT entry array, which can be + * smaller. + */ + if (table->hdr->hdr_lba_start < GPT_MIN_RESERVED / pp->sectorsize + 2) { + printf("GEOM: warning: %s lba_start %llu < required min %d\n", + pp->name, (unsigned long long)table->hdr->hdr_lba_start, + GPT_MIN_RESERVED / pp->sectorsize + 2); + } + basetable->gpt_first = table->hdr->hdr_lba_start; basetable->gpt_last = table->hdr->hdr_lba_end; basetable->gpt_entries = table->hdr->hdr_entries;