]> git.ipfire.org Git - thirdparty/systemd.git/commit
boot: reject GPT headers with SizeOfPartitionEntry below the minimum
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 26 Jun 2026 16:15:38 +0000 (17:15 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 3 Jul 2026 08:13:48 +0000 (09:13 +0100)
commitd06d8a232bf8ff4b27e4b5326dcec9717d89f3bc
tree44a9d27bd0689f31d3b1444b6923ccf4209291c9
parentd04fbcf956a7454b9626c668df5208ca6b5cf385
boot: reject GPT headers with SizeOfPartitionEntry below the minimum

Commit 0cf5f816f22c replaced the original lower-bound check

    if (h->SizeOfPartitionEntry < sizeof(EFI_PARTITION_ENTRY))
            return false;

with a multiple-of check

    if ((h->SizeOfPartitionEntry % sizeof(EFI_PARTITION_ENTRY)) != 0)
            return false;

to additionally require the entry size to be a multiple of 128. The
modulo test is however also satisfied by SizeOfPartitionEntry == 0, so a
GPT header advertising a zero entry size now passes verify_gpt().

Restore the lower bound in addition to the multiple-of check, so the
entry size must be at least sizeof(EFI_PARTITION_ENTRY) and a multiple of
it (128 bytes).

Follow-up for 0cf5f816f22c78740e122dfb6b3942ba4241717b
src/boot/part-discovery.c