Page MenuHomeFreeBSD

gpart: Add warning when the start sector is too low.
ClosedPublic

Authored by imp on Oct 17 2023, 2:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 11:31 PM
Unknown Object (File)
Tue, Oct 22, 11:33 AM
Unknown Object (File)
Wed, Oct 16, 12:53 AM
Unknown Object (File)
Wed, Oct 16, 12:53 AM
Unknown Object (File)
Wed, Oct 16, 12:53 AM
Unknown Object (File)
Wed, Oct 16, 12:15 AM
Unknown Object (File)
Sep 26 2024, 4:40 AM
Unknown Object (File)
Sep 25 2024, 5:44 PM
Subscribers

Details

Summary

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.

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.

I imagine "some tools" is only mkimg w/o D42245.

jrtc27 added inline comments.
sys/geom/part/g_part_gpt.c
1049
1057

Condition divides by sectorsize, this print doesn't

I imagine "some tools" is only mkimg w/o D42245.

I've seen python scripts that create embedded SD images for things like mediatek or similar that also violate these rules. They code is quite ugly...
I imagine no mainstream tool does this, but I'll also note that EDK II likes our old mkimg images and isn't bothered by them, suggesting that they had to cope in the past as well...

EDK II likes our old mkimg images and isn't bothered by them

I think there's not much value in a consumer (system firmware, OS partition handling code) in rejecting a GPT that violates the spec and has a too-low start LBA so I guess it's not too surprising that EDK II accepts it.

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Oct 16, 12:15 AM
This revision was automatically updated to reflect the committed changes.

Sorry I didn't spot this / comment until after commit -- shouldn't this go to stderr? perhaps warnx?