File kexec-tools-Fix-option-checks-to-take-KEXEC_FILE_LOAD.patch of Package kexec-tools

From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 16 Mar 2018 16:40:27 +0100
Subject: kexec: Fix option checks to take KEXEC_FILE_LOAD into account
References: bsc#1080916, boo#1076839
Upstream: merged
Git-commit: bf36a4623b5ef67b3ae9722972fc135c608df963

When kexec_file_load support was added some sanity checks were not updated.

Some options are set only in the kexec_load flags so cannot be supported
wiht kexec_file_load. On the other hand, reserved memory is needed for
kdump with both kexec_load and kexec_file_load.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
Added in v5
---
 kexec/kexec.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index ab8cff7fe083..b793f31ea501 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1415,7 +1415,9 @@ int main(int argc, char *argv[])
 		do_load_jump_back_helper = 0;
 	}
 
-	if (do_load && (kexec_flags & KEXEC_ON_CRASH) &&
+	if (do_load &&
+	    ((kexec_flags & KEXEC_ON_CRASH) ||
+	     (kexec_file_flags & KEXEC_FILE_ON_CRASH)) &&
 	    !is_crashkernel_mem_reserved()) {
 		die("Memory for crashkernel is not reserved\n"
 		    "Please reserve memory by passing"
@@ -1447,6 +1449,12 @@ int main(int argc, char *argv[])
 			}
 		}
 	}
+	if (do_kexec_file_syscall) {
+		if (do_load_jump_back_helper)
+			die("--load-jump-back-helper not supported with kexec_file_load\n");
+		if (kexec_flags & KEXEC_PRESERVE_CONTEXT)
+			die("--load-preserve-context not supported with kexec_file_load\n");
+	}
 
 	if (do_reuse_initrd){
 		check_reuse_initrd();
-- 
2.13.6

openSUSE Build Service is sponsored by