[PATCH v2 2/3] ima: keep kexec dump state tied to installed image
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Nov 12 05:07:12 PST 2026
> ima_add_kexec_buffer() updates the global measurement scratch buffer
> and segment size for the new image. If kexec_file_load() fails, the
> new image is freed but the scratch buffer and segment size remain. When
> kexec starts the installed image, ima_update_kexec_buffer() dumps the
> measurement list into the IMA segment. A larger failed segment causes an
> OOB write, while a smaller one truncates the log and reports the wrong
> size in the kexec_execute event. KASAN for instsance reports the OOB
> writes as:
>
> BUG: KASAN: vmalloc-out-of-bounds in ima_update_kexec_buffer+0x265/0x280
> Write of size 868426 at addr ffffc9000004e000 by task init/1
> ...
> __asan_memcpy+0x3b/0x60
> ima_update_kexec_buffer+0x265/0x280
>
> Leave installed scratch state unchanged until all later load steps pass.
> Store new buffers in the candidate and reuse only equal-size installed
> buffers. Emit kexec_load before those steps with the local size.
> Allocation failure still omits the optional segment.
>
> Fixes: 9f0ec4b16f2b ("ima: kexec: move IMA log copy from kexec load to execute")
> Cc: stable at vger.kernel.org
> Signed-off-by: Jérémy Jean <Jeremy.Jean at oss.cyber.gouv.fr>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112125246.2715174-2-Jeremy.Jean@oss.cyber.gouv.fr?part=2
More information about the kexec
mailing list