Re: [PATCH v6 01/14] kexec: Fix CMA segment address translation with non-zero text_offset
From: sashiko-bot
Date: Mon Sep 21 2026 - 05:18:07 EST
> 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@xxxxxxxxxxxxx>
> Cc: Breno Leitao <leitao@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation")
> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921090450.807575-1-ruanjinjie@xxxxxxxxxx?part=1