[PATCH 6.12 04/35] ima: do not copy measurement list to kdump kernel

Greg Kroah-Hartman
2026-04-24T13:43:32Z

From: Steven Chen <chenste@linux.microsoft.com>

[ Upstream commit fe3aebf27dc1875b2a0d13431e2e8cf3cf350cca ]

Kdump kernel doesn't need IMA to do integrity measurement.
Hence the measurement list in 1st kernel doesn't need to be copied to
kdump kernel.

Here skip allocating buffer for measurement list copying if loading
kdump kernel. Then there won't be the later handling related to
ima_kexec_buffer.

Signed-off-by: Steven Chen <chenste@linux.microsoft.com>
Tested-by: Baoquan He <bhe@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/integrity/ima/ima_kexec.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c
index cc418a7e27f20..501b952b36981 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -129,6 +129,9 @@ void ima_add_kexec_buffer(struct kimage *image)
size_t kexec_segment_size;
int ret;

+ if (image->type == KEXEC_TYPE_CRASH)
+ return;
+
/*
* Reserve an extra half page of memory for additional measurements
* added during the kexec load.
--
2.53.0