[PATCH] kexec/zboot: Add boundary check on PE header offset
Simon Horman
horms at kernel.org
Wed May 14 03:45:22 PDT 2025
On Tue, May 13, 2025 at 06:32:40PM +0800, Pingfan Liu wrote:
> If a buildroot enviorment does not provide libzstd and kexec_file_load a
> zstd compressed kernel, it will suffer from coredump.
>
> The following is observed from the coredump
>
> Core was generated by `/sbin/kexec -s -p --command-line=BOOT_IMAGE=\(hd0,gpt2\)/vmlinuz-6.15.0-0.rc5.250509g9c69f8884904.47.fc43.aarch64\ ro\ rootflags=subvol=root\ irqpoll\ nr_cpus=1\ reset_devices\ cgroup_disable=memory\ udev.children-max=2\ panic=10\ swiotlb=noforce\ novmcoredd\ cma=0\ hugetlb_cma=0\ sbsa_gwdt.pretimeout=0 --initrd=/boot/initramfs-6.15.0-0.rc5.250509g9c69f8884904.47.fc43.aarch64kdump.img /boot/vmlinuz-6.15.0-0.rc5.250509g9c69f8884904.47.fc43.aarch64'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> 143 if (!!memcmp(buf, "PE\0\0", 4)) {
> (gdb)
>
> Instead of coredump, it is better to exit elegantly by adding checkout
> on the PE header offset.
>
> Signed-off-by: Pingfan Liu <piliu at redhat.com>
Thanks, applied.
More information about the kexec
mailing list