[PATCH v2 1/3] kho: skip KHO data for context-preserving kexec

Pasha Tatashin pasha.tatashin at soleen.com
Wed May 6 11:20:41 PDT 2026


A preserve_context kexec returns to the current kernel, which means the
2nd kernel does not use KHO data (and their memory spaces don't
overlap). Passing KHO data to the 2nd kernel via setup_data or
devicetree is unnecessary.

Add a check in kho_fill_kimage() and return early if preserve_context is
set, to avoid passing KHO state during context-preserving kexecs.

Fixes: 3bdecc3c93f9 ("kexec: add KHO support to kexec file loads")
Signed-off-by: Pasha Tatashin <pasha.tatashin at soleen.com>
---
 kernel/liveupdate/kexec_handover.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index 4fde8325c49f..2eec2a169c83 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -1702,7 +1702,8 @@ int kho_fill_kimage(struct kimage *image)
 	int err = 0;
 	struct kexec_buf scratch;
 
-	if (!kho_enable || image->type == KEXEC_TYPE_CRASH)
+	if (!kho_enable || image->type == KEXEC_TYPE_CRASH ||
+	    image->preserve_context)
 		return 0;
 
 	image->kho.fdt = virt_to_phys(kho_out.fdt);
-- 
2.54.0.545.g6539524ca2-goog




More information about the kexec mailing list