From: Eric DeVolder <eric.devolder@oracle.com>
To: linux-kernel@vger.kernel.org, david@redhat.com,
osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com,
kexec@lists.infradead.org
Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org,
vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com,
akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com,
zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz,
tiwai@suse.de, seanjc@google.com, linux@weissschuh.net,
vschneid@redhat.com, linux-mm@kvack.org,
linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com,
konrad.wilk@oracle.com, boris.ostrovsky@oracle.com,
eric.devolder@oracle.com
Subject: [PATCH v27 3/8] kexec: exclude elfcorehdr from the segment digest
Date: Fri, 11 Aug 2023 13:06:37 -0400 [thread overview]
Message-ID: <20230811170642.6696-4-eric.devolder@oracle.com> (raw)
In-Reply-To: <20230811170642.6696-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. The digest is embedded into
the purgatory image prior to placing in memory.
Updates to the elfcorehdr in response to CPU and memory changes
would cause the purgatory integrity checking to fail (at crash time,
and no vmcore created). Therefore, the elfcorehdr segment is
explicitly excluded from the purgatory digest, enabling updates to
the elfcorehdr while also avoiding the need to recompute the hash
digest and reload purgatory.
Suggested-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Acked-by: Hari Bathini <hbathini@linux.ibm.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 453b7a513540..e2ec9d7b9a1f 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -726,6 +726,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
+ /* Exclude elfcorehdr segment to allow future changes via hotplug */
+ if (j == image->elfcorehdr_index)
+ continue;
+#endif
+
ksegment = &image->segment[i];
/*
* Skip purgatory as it will be modified once we put digest
--
2.31.1
next prev parent reply other threads:[~2023-08-11 17:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 17:06 [PATCH v27 0/8] crash: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2023-08-11 17:06 ` [PATCH v27 1/8] crash: move a few code bits to setup support of crash hotplug Eric DeVolder
2023-08-11 17:06 ` [PATCH v27 2/8] crash: add generic infrastructure for crash hotplug support Eric DeVolder
2023-08-12 10:47 ` Sourabh Jain
2023-08-15 14:40 ` Eric DeVolder
2023-08-11 17:06 ` Eric DeVolder [this message]
2023-08-11 17:06 ` [PATCH v27 4/8] crash: memory and CPU hotplug sysfs attributes Eric DeVolder
2023-08-11 17:06 ` [PATCH v27 5/8] x86/crash: add x86 crash hotplug support Eric DeVolder
2023-08-11 17:06 ` [PATCH v27 6/8] crash: hotplug support for kexec_load() Eric DeVolder
2023-08-11 17:06 ` [PATCH v27 7/8] crash: change crash_prepare_elf64_headers() to for_each_possible_cpu() Eric DeVolder
2023-08-11 17:06 ` [PATCH v27 8/8] x86/crash: optimize CPU changes 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=20230811170642.6696-4-eric.devolder@oracle.com \
--to=eric.devolder@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=kexec@lists.infradead.org \
--cc=konrad.wilk@oracle.com \
--cc=lf32.dev@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@weissschuh.net \
--cc=mingo@redhat.com \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=osalvador@suse.de \
--cc=rafael@kernel.org \
--cc=seanjc@google.com \
--cc=sourabhjain@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.de \
--cc=vbabka@suse.cz \
--cc=vgoyal@redhat.com \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
--cc=zohar@linux.ibm.com \
/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).