Repository navigation
multiboot, elf: Support disjoint ELF segments on UEFI - #705
Merged
Mintsuki merged 1 commit intoNov 14, 2026
Merged
Conversation
hotline1337
force-pushed
the
fix/multiboot-multirange-elf
branch
3 times, most recently
from
November 7, 2026 18:24
2989078 to
8499a3f
Compare
hotline1337
force-pushed
the
fix/multiboot-multirange-elf
branch
from
November 10, 2026 12:46
8499a3f to
1f39d86
Compare
Assisted-by: Antigravity:gemini-4-carbon Signed-off-by: hotline1337 <denuvo at tuta dot io>
hotline1337
force-pushed
the
fix/multiboot-multirange-elf
branch
from
November 10, 2026 13:07
1f39d86 to
34011f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PT_LOADsegment incommon/lib/elf.c.Background & Problem
Kernels with disjoint ELF segments, such as seL4 with bootstrap headers at 1 MiB and kernel code at 16 MiB, can fail to boot under UEFI via Multiboot 1 or 2 (#704):
[min_paddr, max_paddr)span as oneelsewhere_range, including gaps between loadable segments.check_usable_memory()rejected the entire range if firmware reserved memory in a gap, even when every segment's target was usable.Changes
common/lib/elf.c,common/lib/elf.h: Return a staging range for each non-emptyPT_LOADsegment. Sort ranges by target address, reject overlapping loadable targets, and check for overlaps between a target and another segment's staging buffer.common/protos/multiboot1.c: Check each kernel range against the 4 GiB limit and usable memory; validate the entry point and reserve each target range.common/protos/multiboot2.c: Apply the relocation slide to all kernel ranges. Keep the full image span for relocation bounds, but check usable and loader memory per segment. Validate the 4 GiB limit and entry point, and reserve each target range.checks/cases/multiboot_elf.py: Add Multiboot 1 and 2 boot cases with a distant header segment, plus hostile ELF cases with overlapping segments.Verification & Testing
checks/run-checks -k 'multiboot_elf.*'on BIOS and x86-64 UEFI: 8/8 passed.AI assistance disclosure
The fix was developed by a human, and verified with material AI help (gemini-4-carbon). The commit carries the corresponding
Assisted-by:trailer.Fixes #704