Skip to contentSkip to conversation

partitions: efi: validate complete GPT entry array

PATCH Applied Ahmad Fatoum 2 participants 2 messages Jul 9 – Jul 10

lore
Share & tools
lore
#0 lore raw

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.

Fixes a576f2f7e5af ("partitions: efi: fix overflow issues while allocating gpt entries")
Assisted-by Codex:gpt-5.5
---
 common/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/partitions/efi.c +1 -1
index 18a8c4d56632..7ec54a98e335 100644
@@ -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
Applied
#1 lore raw
Quoted 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_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.

[...]

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]>