[PATCH v6 01/14] kexec: Fix CMA segment address translation with non-zero text_offset

sashiko-bot at kernel.org sashiko-bot at kernel.org
Mon Sep 21 02:17:57 PDT 2026


> kimage_load_cma_segment() and kimage_map_segment() both translate
> a CMA segment using page_address(cma), which returns the CMA base
> address. This ignores segment->mem.
> 
> On arm64, image_load() adds text_offset to segment->mem before the
> segment is loaded:
> 
> 	kernel_segment->mem += text_offset;
> 	kernel_segment->memsz -= text_offset;
> 	image->start = kernel_segment->mem;
> 
> so segment->mem no longer matches the CMA base.  The kernel payload is
> therefore copied to the wrong offset, while image->start points past
> it, and kexec jumps into the middle of the kernel.
> 
> [ ... ]
> Cc: Sourabh Jain <sourabhjain at linux.ibm.com>
> Cc: Breno Leitao <leitao at debian.org>
> Cc: stable at vger.kernel.org
> Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation")
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921090450.807575-1-ruanjinjie@huawei.com?part=1




More information about the kexec mailing list