From: Eric DeVolder <eric.devolder@oracle.com>
To: kexec@lists.infradead.org
Subject: [PATCH v6 5/8] kexec: exclude elfcorehdr from the segment digest
Date: Fri, 1 Apr 2022 14:30:37 -0400 [thread overview]
Message-ID: <20220401183040.1624-6-eric.devolder@oracle.com> (raw)
In-Reply-To: <20220401183040.1624-1-eric.devolder@oracle.com>
When a crash kernel is loaded via the kexec_file_load syscall, the
kernel places the various segments (ie crash kernel, crash initrd,
boot_params, elfcorehdr, purgatory, etc) in memory. For those
architectures that utilize purgatory, a hash digest of the segments
is calculated for integrity checking. This digest is embedded into
the purgatory image prior to placing purgatory in memory.
Since hotplug events cause changes to the elfcorehdr, purgatory
integrity checking fails (at crash time, and no kdump created).
As a result, this change explicitly excludes the elfcorehdr segment
from the list of segments used to create the digest. By doing so,
this permits changes to the elfcorehdr in response to hotplug events,
without having to also reload purgatory due to the change to the
digest.
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
Acked-by: Baoquan He <bhe@redhat.com>
---
kernel/kexec_file.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 801d0d0a5012..94a459209111 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -765,6 +765,12 @@ static int kexec_calculate_store_digests(struct kimage *image)
for (j = i = 0; i < image->nr_segments; i++) {
struct kexec_segment *ksegment;
+#ifdef CONFIG_CRASH_HOTPLUG
+ /* This segment excluded to allow future changes via hotplug */
+ if (image->elfcorehdr_index_valid && (j == image->elfcorehdr_index))
+ continue;
+#endif
+
ksegment = &image->segment[i];
/*
* Skip purgatory as it will be modified once we put digest
--
2.27.0
next prev parent reply other threads:[~2022-04-01 18:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 18:30 [PATCH v6 0/8] crash: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 1/8] x86/crash: fix minor typo/bug in debug message Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 2/8] x86/crash: Introduce new options to support cpu and memory hotplug Eric DeVolder
2022-04-08 8:07 ` Baoquan He
2022-04-11 13:54 ` Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 3/8] crash: prototype change for crash_prepare_elf64_headers Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 4/8] crash: add generic infrastructure for crash hotplug support Eric DeVolder
2022-04-11 9:20 ` Baoquan He
2022-04-11 13:54 ` Eric DeVolder
2022-04-13 2:41 ` Baoquan He
2022-04-13 12:37 ` Eric DeVolder
2022-04-13 13:24 ` Baoquan He
2022-04-01 18:30 ` Eric DeVolder [this message]
2022-04-01 18:30 ` [PATCH v6 6/8] kexec: exclude hot remove cpu from elfcorehdr notes Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 7/8] x86/crash: Add x86 crash hotplug support for kexec_file_load Eric DeVolder
2022-04-01 18:30 ` [PATCH v6 8/8] x86/crash: Add x86 crash hotplug support for kexec_load Eric DeVolder
2022-04-13 13:13 ` Baoquan He
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=20220401183040.1624-6-eric.devolder@oracle.com \
--to=eric.devolder@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;
as well as URLs for NNTP newsgroup(s).