[PATCH v1 1/7] crashdump: introduce the --hotplug option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This change introduces the --hotplug option which is to indicate
that kernel changes to the elfcorehdr, in response to hot un/plug
events, can occur.

Beginning with Linux kernel v6.x (FIX!), the kernel can modify
the elfcorehdr in response to hotplug changes to cpus and memory.
As such, the buffer containing the elfcorehdr must be excluded
from the purgatory checksum/digest; otherwise kernel changes to
the elfcorehdr as a result of hotplug would result in the checksum
failing at panic kernel boot time, and kdump fail.

This option excludes the elfcorehdr buffer from the purgatory
checksum/digest so that kernel changes to the elfcorehdr can occur.

This option is only meaningful for kexec_load syscall. For the
kexec_file_load syscall, this option is a no-op as the kernel
handles all the kexec memory segments appropriately.

Signed-off-by: Eric DeVolder <eric.devolder@xxxxxxxxxx>
---
 kexec/kexec.c | 6 ++++++
 kexec/kexec.h | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 0e92d96..1276726 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -62,6 +62,7 @@ static unsigned long kexec_flags = 0;
 /* Flags for kexec file (fd) based syscall */
 static unsigned long kexec_file_flags = 0;
 int kexec_debug = 0;
+int do_hotplug = 0;
 
 void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr)
 {
@@ -1057,6 +1058,8 @@ void usage(void)
 	       " -d, --debug          Enable debugging to help spot a failure.\n"
 	       " -S, --status         Return 1 if the type (by default crash) is loaded,\n"
 	       "                      0 if not.\n"
+	       " --hotplug            Enable kernel modification of the elfcorehdr, in\n"
+	       "                      response to hot un/plug changes to CPUs and memory\n"
 	       "\n"
 	       "Supported kernel file types and options: \n");
 	for (i = 0; i < file_types; i++) {
@@ -1565,6 +1568,9 @@ int main(int argc, char *argv[])
 		case OPT_PRINT_CKR_SIZE:
 			print_crashkernel_region_size();
 			return 0;
+		case OPT_HOTPLUG:
+			do_hotplug = 1;
+			break;
 		default:
 			break;
 		}
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 0d820ad..7f7936d 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -231,7 +231,8 @@ extern int file_types;
 #define OPT_PRINT_CKR_SIZE	262
 #define OPT_LOAD_LIVE_UPDATE	263
 #define OPT_EXEC_LIVE_UPDATE	264
-#define OPT_MAX			265
+#define OPT_HOTPLUG		265
+#define OPT_MAX			266
 #define KEXEC_OPTIONS \
 	{ "help",		0, 0, OPT_HELP }, \
 	{ "version",		0, 0, OPT_VERSION }, \
@@ -258,6 +259,8 @@ extern int file_types;
 	{ "debug",		0, 0, OPT_DEBUG }, \
 	{ "status",		0, 0, OPT_STATUS }, \
 	{ "print-ckr-size",     0, 0, OPT_PRINT_CKR_SIZE }, \
+	{ "hotplug",		0, 0, OPT_HOTPLUG }, \
+
 
 #define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
 
@@ -292,6 +295,8 @@ extern void arch_reuse_initrd(void);
 
 extern int ifdown(void);
 
+extern int do_hotplug;
+
 extern char purgatory[];
 extern size_t purgatory_size;
 
-- 
2.31.1


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux