git: 90c4aec77ca2 - stable/14 - gpart: Add warning when the start sector is too low.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 12 Apr 2026 22:17:12 UTC
The branch stable/14 has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=90c4aec77ca2ead1975be9d0ba0cea29f55e9632
commit 90c4aec77ca2ead1975be9d0ba0cea29f55e9632
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-10-16 00:03:03 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-04-12 22:08: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
(cherry picked from commit 2cbda736cea8f82cfc5caab0f6099f0fbfe28537)
---
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 de22d385af41..3e1f8dbde6dc 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -1046,6 +1046,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;