[PATCH] disk: gpt: verify alternate LBA points to last usable LBA

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Mar 9 18:15:43 CET 2021


On 09.03.21 17:24, Stefan Herbrechtsmeier wrote:
> Hi Heinrich,
>
> Am 08.03.2021 um 18:38 schrieb Heinrich Schuchardt:
>> On 08.03.21 17:07, Stefan Herbrechtsmeier wrote:
>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
>>>
>>> The gpt command require the GPT backup header at the standard location
>>> at the end of the device.Check the alternate LBA value before reading
>>> the GPT backup header from the last usable LBA of the device.
>>
>> If there is a bug in the gpt command, please, fix it instead of
>> introducing constraints that don't exist in the UEFI specification.
>>
>> The UEFI specification has:
>>
>> "The backup GPT Partition Entry Array must be located after the Last
>> Usable LBA and end before the backup GPT Header."
>
> "If the primary GPT is invalid, the backup GPT is used instead and it is
> located on the last logical block on the disk." [UEFI specification 2.8,
> S. 120]

Thank you for pointing me to this sentence which I missed.

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

>
> "Note that UEFI standard requires the backup header at the end of the
> device and partitioning tools can automatically relocate the header to
> follow the standard." [sfdisk man page, --relocate, gpt-bak-mini]
>
> What should U-Boot do? I have a patch to use the backup GPT header if
> only the header itself is valid but I don't know if this behavior is
> correct.
>
> Regards,
>   Stefan



More information about the U-Boot mailing list