> kimage_load_cma_segment() and kimage_map_segment() translate a CMA > segment to a kernel virtual address with page_address(cma), ignoring > segment->mem. But arm64's image_load() adds text_offset to segment->mem, > so the kernel payload is copied to the wrong offset while image->start > points past it, and kexec jumps into the middle of the kernel. > kimage_map_segment() has the same problem for any CMA segment whose mem > was moved. > > Add kimage_cma_vaddr() to translate a boot physical address inside a CMA > segment to its virtual address, and use it in both places. > > Cc: Andrew Morton <[email protected]> > Cc: Baoquan He <[email protected]> > Cc: Mike Rapoport <[email protected]> > Cc: Pasha Tatashin <[email protected]> > Cc: Pratyush Yadav <[email protected]> > Cc: Pingfan Liu <[email protected]> > Cc: Justinien Bouron <[email protected]> > Cc: Sourabh Jain <[email protected]> > Cc: [email protected] > Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation") > Signed-off-by: Jinjie Ruan <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
