partitions: efi: validate complete GPT entry array
PATCH 1/1 partitions: efi: validate complete GPT entry array
The Fedora-Workstation-Live-44-1.7.aarch64.iso image advertises 248 slots, which exceeds the 128 partition limit that the barebox EFI partition parser enforced because of the MAX_PARTITION macro.
The enforcement is not only for creating actual partitions, but also for computing the CRC, so valid GPTs with a larger entry array are rejected, even though they have fewer actual partitions.
Read the complete entry array for validation while keeping the existing export limit when partitions are registered.
--- common/partitions/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/partitions/efi.c +1 -1
@@ -142,7 +142,7 @@ static u32 compute_partitions_entries_size(const gpt_header *gpt) {u32 nb_parts, sz_parts, total_size; - nb_parts =min_t (u32,MAX_PARTITION ,le32_to_cpu (gpt->num_partition_entries)); + nb_parts =le32_to_cpu (gpt->num_partition_entries); sz_parts =le32_to_cpu (gpt->sizeof_partition_entry);if (check_mul_overflow (nb_parts, sz_parts, &total_size))
Signature · 1 line
2.47.3
Sascha Hauer
AppliedQuoted 9 lines · Ahmad Fatoum
The Fedora-Workstation-Live-44-1.7.aarch64.iso image advertises 248 slots, which exceeds the 128 partition limit that the barebox EFI partition parser enforced because of the
MAX_PARTITIONmacro.The enforcement is not only for creating actual partitions, but also for computing the CRC, so valid GPTs with a larger entry array are rejected, even though they have fewer actual partitions.
[...]
Applied, thanks!
[1/1] partitions: efi: validate complete GPT entry array
https://git.pengutronix.de/cgit/barebox/commit/?id=9317ffc12b61 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>