[PATCH V2] ima: do not copy measurement list to kdump kernel

steven chen chenste at linux.microsoft.com
Tue May 13 07:31:29 PDT 2025


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

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 at linux.microsoft.com>
Tested-by: Baoquan He <bhe at redhat.com>
Acked-by: Baoquan He <bhe at redhat.com>
---
V1 - https://lore.kernel.org/all/20250502200337.6293-1-chenste@linux.microsoft.com/
V2 - Incorporated feedback from the community (Baoquan He and Mimi Zohar) on v1

 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 38cb2500f4c3..7362f68f2d8b 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -146,6 +146,9 @@ void ima_add_kexec_buffer(struct kimage *image)
 	void *kexec_buffer = NULL;
 	int ret;
 
+	if (image->type == KEXEC_TYPE_CRASH)
+		return;
+
 	/*
 	 * Reserve extra memory for measurements added during kexec.
 	 */
-- 
2.43.0




More information about the kexec mailing list