Page MenuHomeFreeBSD

gpart: More nuance for GPT support
ClosedPublic

Authored by imp on Oct 17 2023, 2:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 12:38 AM
Unknown Object (File)
Fri, Nov 29, 9:50 PM
Unknown Object (File)
Fri, Nov 29, 8:43 PM
Unknown Object (File)
Mon, Nov 18, 11:21 PM
Unknown Object (File)
Oct 16 2024, 4:33 AM
Unknown Object (File)
Oct 16 2024, 12:54 AM
Unknown Object (File)
Oct 16 2024, 12:54 AM
Unknown Object (File)
Sep 27 2024, 2:16 PM

Details

Summary

A careful reading of the GPT standard shows that one may have fewer than
128 entries in your GPT table. While the standard requires that we
reserve enough space (32 512-byte-LBAs or 4 4096-byte-LBAs), it also
explicitly allows one to specify fewer actual partitions (since that
controls what is in the CRC). It requires that the first LBA to be 32
(512 sectors) or 6 (4k sectors) or larger. That requirement is not
enforced (it's not listed as one of validation criteria for the GPT).
We should likely do so in the future.

To that end, allow a default number of entries to use (defent) on
creation to be different (larger) than the minimum number of legal
entries. For gpt, these numbers work out to 128 and 1 respectively. For
all the others, make minent == defent so this is a nop for those
partitioning schemes.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Oct 17 2023, 2:28 AM
imp created this revision.
sys/geom/part/g_part.h
121–124

strange indentation, but I assume is just Phabricator rendering bug

sys/geom/part/g_part_gpt.c
157–158

is it possible for this to introduce any new breakage? e.g. do we start violating the start LBA with something like gpart create -s gpt -n 1?

jrtc27 added inline comments.
sys/geom/part/g_part.h
121–124

Show Raw File (Right) confirms the indentation looks sensible in reality

zlei added a subscriber: zlei.

Looks good to me.

sys/geom/part/g_part.h
121–123

One tab before comment should be sufficient.

This revision is now accepted and ready to land.Oct 21 2023, 4:12 PM

I'm unsure about this

sys/geom/part/g_part_gpt.c
157–158

I don't think so

I'm unsure about this

sys/geom/part/g_part_gpt.c
157–158

But I'll experiment

I'm going to commit this, but will be inclined to revert on problems rather than powering through them.

sys/geom/part/g_part_gpt.c
157–158

So, you can create non-conforming GPT Tables, but they are well-formed for most other software. You can't create something that's so crazy as to be inconsistent enough for other software to reject. The defaults are good, and but we allow more flexibility, which is consistent with trying not to be overly prescriptive.

OK -- given that there is no change by default this is fine with me

This revision was automatically updated to reflect the committed changes.