The stub copies the embedded kernel PE into an xmalloc_pages() allocation with AllocateAnyPages, which only guarantees EFI_PAGE_SIZE (4 KiB) alignment. The arm64 kernel declares SectionAlignment = SZ_64K. When _text is not 64K-aligned the kernel's EFI stub reallocates and copies the image, which can fail with EFI_OUT_OF_RESOURCES on memory-constrained firmware (e.g. U-Boot, bounded by CONFIG_SYS_MALLOC_LEN rather than full DRAM). The failure is non-deterministic since AllocateAnyPages returns whatever page the allocator finds first. Plumb SectionAlignment through pe_kernel_info() and allocate via xmalloc_aligned_pages(). For alignment <= EFI_PAGE_SIZE (e.g. x86_64) it reduces to a plain AllocatePages(), so the change is free there. SectionAlignment comes from the PE header, which the spec requires to be a power of 2. Sanitize it in pe_kernel_info() right where it is parsed: a non-conforming value falls back to plain page alignment (matching the behavior of older systemd-stub versions that ignored the field) rather than propagate something that would break xmalloc_aligned_pages()'s over-alignment maths, with a log_warning() so the fallback stays diagnosable. Co-developed-by: Claude <claude@anthropic.com> Closes: #42443 Reported-By: Agathe Porte <agathe.porte@oss.qualcomm.com> Tested-By: Agathe Porte <agathe.porte@oss.qualcomm.com>
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
