f69881
From 29fe5067ed07452bcbbbe5fcd0b4e4215f598014 Mon Sep 17 00:00:00 2001
f69881
From: =?UTF-8?q?Ahelenia=20Ziemia=C5=84ska?=
f69881
 <nabijaczleweli@nabijaczleweli.xyz>
f69881
Date: Fri, 3 Feb 2023 00:10:18 +0100
f69881
Subject: [PATCH 2/6] kexec: make -a the default
f69881
MIME-Version: 1.0
f69881
Content-Type: text/plain; charset=UTF-8
f69881
Content-Transfer-Encoding: 8bit
f69881
f69881
AFAICT, there's no downside to this, and running into this each time
f69881
I want to kexec (and, presumably, a significant chunk of the population,
f69881
since lockdown is quite popular) on some machines,
f69881
then going to the manual, then finding out I want the /auto/ flag(!)
f69881
is quite annoying:
f69881
  # kexec -l /boot/vmlinuz-6.1.0-3-amd64 --initrd /boot/initrd.img-6.1.0-3-amd64 --reuse-cmdline
f69881
  kexec_load failed: Operation not permitted
f69881
  entry       = 0x46eff7760 flags = 0x3e0000
f69881
  nr_segments = 7
f69881
  segment[0].buf   = 0x557cd303efa0
f69881
  segment[0].bufsz = 0x70
f69881
  segment[0].mem   = 0x100000
f69881
  segment[0].memsz = 0x1000
f69881
  segment[1].buf   = 0x557cd3046fe0
f69881
  segment[1].bufsz = 0x190
f69881
  segment[1].mem   = 0x101000
f69881
  segment[1].memsz = 0x1000
f69881
  segment[2].buf   = 0x557cd303f6e0
f69881
  segment[2].bufsz = 0x30
f69881
  segment[2].mem   = 0x102000
f69881
  segment[2].memsz = 0x1000
f69881
  segment[3].buf   = 0x7f658fa37010
f69881
  segment[3].bufsz = 0x12a51b5
f69881
  segment[3].mem   = 0x46a55a000
f69881
  segment[3].memsz = 0x12a6000
f69881
  segment[4].buf   = 0x7f6590ce1210
f69881
  segment[4].bufsz = 0x7e99e0
f69881
  segment[4].mem   = 0x46b800000
f69881
  segment[4].memsz = 0x377c000
f69881
  segment[5].buf   = 0x557cd3039350
f69881
  segment[5].bufsz = 0x42fa
f69881
  segment[5].mem   = 0x46eff2000
f69881
  segment[5].memsz = 0x5000
f69881
  segment[6].buf   = 0x557cd3032000
f69881
  segment[6].bufsz = 0x70e0
f69881
  segment[6].mem   = 0x46eff7000
f69881
  segment[6].memsz = 0x9000
f69881
f69881
Closes: https://bugs.debian.org/1030248
f69881
Signed-off-by: Ahelenia ZiemiaƄska <nabijaczleweli@nabijaczleweli.xyz>
f69881
Signed-off-by: Simon Horman <horms@kernel.org>
f69881
---
f69881
 kexec/kexec.8 | 4 ++--
f69881
 kexec/kexec.c | 8 ++++----
f69881
 2 files changed, 6 insertions(+), 6 deletions(-)
f69881
f69881
diff --git a/kexec/kexec.8 b/kexec/kexec.8
f69881
index 3ebede6..66453b8 100644
f69881
--- a/kexec/kexec.8
f69881
+++ b/kexec/kexec.8
f69881
@@ -151,14 +151,14 @@ Specify that the new kernel is of this
f69881
 Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively.
f69881
 .TP
f69881
 .BI \-c\ (\-\-kexec-syscall)
f69881
-Specify that the old KEXEC_LOAD syscall should be used exclusively (the default).
f69881
+Specify that the old KEXEC_LOAD syscall should be used exclusively.
f69881
 .TP
f69881
 .BI \-a\ (\-\-kexec-syscall-auto)
f69881
 Try the new KEXEC_FILE_LOAD syscall first and when it is not supported or the
f69881
 kernel does not understand the supplied image fall back to the old KEXEC_LOAD
f69881
 interface.
f69881
 
f69881
-There is no one single interface that always works.
f69881
+There is no one single interface that always works, so this is the default.
f69881
 
f69881
 KEXEC_FILE_LOAD is required on systems that use locked-down secure boot to
f69881
 verify the kernel signature.  KEXEC_LOAD may be also disabled in the kernel
f69881
diff --git a/kexec/kexec.c b/kexec/kexec.c
f69881
index 0e92d96..36bb2ad 100644
f69881
--- a/kexec/kexec.c
f69881
+++ b/kexec/kexec.c
f69881
@@ -1049,11 +1049,11 @@ void usage(void)
f69881
 	       "                      to original kernel.\n"
f69881
 	       " -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
f69881
 	       " -c, --kexec-syscall  Use the kexec_load syscall for for compatibility\n"
f69881
-	       "                      with systems that don't support -s (default)\n"
f69881
+	       "                      with systems that don't support -s\n"
f69881
 	       " -a, --kexec-syscall-auto  Use file based syscall for kexec and fall\n"
f69881
 	       "                      back to the compatibility syscall when file based\n"
f69881
 	       "                      syscall is not supported or the kernel did not\n"
f69881
-	       "                      understand the image\n"
f69881
+	       "                      understand the image (default)\n"
f69881
 	       " -d, --debug          Enable debugging to help spot a failure.\n"
f69881
 	       " -S, --status         Return 1 if the type (by default crash) is loaded,\n"
f69881
 	       "                      0 if not.\n"
f69881
@@ -1407,8 +1407,8 @@ int main(int argc, char *argv[])
f69881
 	int do_ifdown = 0, skip_ifdown = 0;
f69881
 	int do_unload = 0;
f69881
 	int do_reuse_initrd = 0;
f69881
-	int do_kexec_file_syscall = 0;
f69881
-	int do_kexec_fallback = 0;
f69881
+	int do_kexec_file_syscall = 1;
f69881
+	int do_kexec_fallback = 1;
f69881
 	int skip_checks = 0;
f69881
 	int do_status = 0;
f69881
 	void *entry = 0;
f69881
-- 
f69881
2.33.1
f69881