[PATCH v1 2/7] crashdump: exclude elfcorehdr segment from digest for hotplug

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

 



To allow modification of the elfcorehdr by the kernel, in
response to hot un/plug events, the buffer containing the
elfcorehdr must be excluded from the purgatory checksum/digest.

To do so, the address of the elfcorehdr is stored in info->elfcorehdr,
and the buffer is excluded from the checksum if the --hotplug option
is in effect.

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

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 1276726..90f2e71 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -673,6 +673,15 @@ static void update_purgatory(struct kexec_info *info)
 		if (info->segment[i].mem == (void *)info->rhdr.rel_addr) {
 			continue;
 		}
+
+		/* Do not include the elfcorehdr in the checksum, if hotplug
+		 * support is enabled. The elfcorehdr is modified upon
+		 * hotplug changes, and would fail checksum at crash time.
+		 */
+		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 7f7936d..9a26065 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -169,6 +169,7 @@ struct kexec_info {
 	int command_line_len;
 
 	int skip_checks;
+	unsigned long elfcorehdr;
 };
 
 struct arch_map_entry {
-- 
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