Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric DeVolder <eric.devolder@oracle.com>
To: kexec@lists.infradead.org
Cc: boris.ostrovsky@oracle.com, eric.devolder@oracle.com
Subject: [PATCH v1 1/7] crashdump: introduce the --hotplug option
Date: Thu, 20 Oct 2022 13:03:38 -0400	[thread overview]
Message-ID: <20221020170344.1962-2-eric.devolder@oracle.com> (raw)
In-Reply-To: <20221020170344.1962-1-eric.devolder@oracle.com>

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@oracle.com>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2022-10-20 17:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 17:03 [PATCH v1 0/7] crashdump: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2022-10-20 17:03 ` Eric DeVolder [this message]
2022-10-20 17:03 ` [PATCH v1 2/7] crashdump: exclude elfcorehdr segment from digest for hotplug Eric DeVolder
2022-10-20 17:03 ` [PATCH v1 3/7] crashdump/x86: identify elfcorehdr segment " Eric DeVolder
2022-10-20 17:03 ` [PATCH v1 4/7] kexec: create get_nr_cpus() Eric DeVolder
2022-10-20 17:03 ` [PATCH v1 5/7] crashdump: introduce --elfcorehdrsz option Eric DeVolder
2022-10-20 17:03 ` [PATCH v1 6/7] crashdump: create get_elfcorehdrsz() Eric DeVolder
2022-10-20 17:03 ` [PATCH v1 7/7] crashdump/x86: utilize get_elfcorehdrsz() Eric DeVolder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221020170344.1962-2-eric.devolder@oracle.com \
    --to=eric.devolder@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox