fix(uki): correct malformed section layout in UKI - #137
Merged
Merged
Conversation
…y dracut Introduce the `uki_reassemble` function to recalculate and fix absolute VMA layouts for UKI sections. Legacy dracut (< 059-3) hardcodes section VMAs assuming an ImageBase of 0. When paired with modern systemd stubs (>= v254, built with lld) that use a large ImageBase, objcopy's RVA calculation underflows. This causes SizeOfImage to bloat abnormally (e.g., ~2.9 GiB for ~0.12 GiB of data), leading to extremely slow boot times or outright rejection by strict UEFI firmware. This commit resolves the issue by: - Dynamically deriving the first free VMA immediately after the stub's own sections, ensuring payload sections are placed contiguously without RVA underflow. - Invoking the reassembly function during the conversion pipeline to guarantee structurally sound UKI generation regardless of the host's dracut version. - Logging the final SizeOfImage versus file size, explicitly failing the conversion if a massive memory hole is still detected as a sanity check. - Adding comprehensive documentation detailing the root cause, the math behind the underflow, and the dynamic offset algorithm used for the fix.
|
@Just-do-st ,您好,您的请求已接收,请耐心等待结果。 |
|
@Just-do-st ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
imlk0
added a commit
that referenced
this pull request
Sep 20, 2026
CI never passed uki_stub_version, so every UKI job used the distro stub (ImageBase=0, no SizeOfImage hole) and the reassembly fix from #137 was never exercised against a real pinned stub that has the hole. Plumb --uki-stub-version through test-convert.sh + the Makefile, and add two targeted matrix rows (uki/noenc/disk on alinux3 and alinux4) that carry uki_stub_version=258 + boot_matrix="2:4G 4:8G 4:16G". The 2:4G entry is what surfaces the SizeOfImage hole on a pinned stub at low RAM; the fix should make it boot. The baseline 24 jobs no longer carry a boot matrix (single boot, distro stub), cutting CI cost vs applying the 3-boot matrix to all rows. The two new vars reach make via the step env + docker exec --env (make imports them from the environment), avoiding inline quoting through bash -c. zstd is installed in the test container for the host-side Arch-Archive stub extraction. Assisted-by: Claude:glm-5.2 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
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.
fix(uki): correct malformed section layout in UKIs generated by legacy dracut
Introduce the
uki_reassemblefunction to recalculate and fix absolute VMA layouts for UKI sections.Legacy dracut (< 059-3) hardcodes section VMAs assuming an ImageBase of 0. When paired with modern systemd stubs (>= v254, built with lld) that use a large ImageBase, objcopy's RVA calculation underflows. This causes SizeOfImage to bloat abnormally (e.g., ~2.9 GiB for ~0.12 GiB of data), leading to extremely slow boot times or outright rejection by strict UEFI firmware.
This commit resolves the issue by: