summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric DeVolder <eric.devolder@oracle.com>2023-09-27 14:11:34 -0400
committerSimon Horman <horms@kernel.org>2023-10-04 14:04:31 +0200
commita56376080a9378a40a85cef455f7455a48d171ce (patch)
tree9ae7e9d473ab0fe9080f8ffab7e10f9064409dc5
parent75ac71fd94fff254cc86b31c55d5f75dda423ea3 (diff)
downloadkexec-tools-a56376080a9378a40a85cef455f7455a48d171ce.tar.gz
crashdump: exclude elfcorehdr segment from digest for hotplug
To allow direct modification of the elfcorehdr by the kernel, in response to CPU and memory hot un/plug and/or online/offline events, the buffer containing the elfcorehdr must be excluded from the purgatory checksum/digest. If the elfcorehdr is not excluded from the purgatory checksum/digest, then at panic time, the checksum/digest check fails (due to the elfcorehdr having been modified), and the kdump capture kernel does not start. Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Signed-off-by: Simon Horman <horms@kernel.org>
-rw-r--r--kexec/kexec.c8
-rw-r--r--kexec/kexec.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 02076081..fdb4c984 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -689,6 +689,14 @@ static void update_purgatory(struct kexec_info *info)
if (info->segment[i].mem == (void *)info->rhdr.rel_addr) {
continue;
}
+
+ /* Don't include elfcorehdr in the checksum, if hotplug
+ * support enabled.
+ */
+ if (do_hotplug && (info->segment[i].mem == (void *)info->elfcorehdr)) {
+ continue;
+ }
+
sha256_update(&ctx, info->segment[i].buf,
info->segment[i].bufsz);
nullsz = info->segment[i].memsz - info->segment[i].bufsz;
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 487f707a..1004aff1 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -170,6 +170,7 @@ struct kexec_info {
int command_line_len;
int skip_checks;
+ unsigned long elfcorehdr;
};
struct arch_map_entry {