kexec_file_load() can change the global IMA buffer size or destination mapping before the new image is installed. If the load fails, the old image remains installed with this mismatched state. Unload and legacy replacement can also free pages without clearing the mapping. The later measurement copy can then overwrite the installed image or freed pages.
In this v2: * Patch 1/3 updates IMA only after the machine post-load hook succeeds. * Patch 2/3 keeps the dump size tied to the installed image. * Patch 3/3 checks mapping ownership and clear stale state on unload or legacy replacement. Jérémy Jean (3): kexec_file: update IMA after machine post-load ima: keep kexec dump state tied to installed image ima: clear kexec state when replacing file image include/linux/ima.h | 1 + kernel/kexec.c | 11 ++++ kernel/kexec_file.c | 15 ++++- security/integrity/ima/ima_kexec.c | 98 +++++++++++++++++++----------- 4 files changed, 88 insertions(+), 37 deletions(-)
