public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y
@ 2024-08-05 15:07 Petr Tesarik
  2024-08-05 15:17 ` Petr Tesarik
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Petr Tesarik @ 2024-08-05 15:07 UTC (permalink / raw)
  To: Eric Biederman, Sourabh Jain, Hari Bathini, Baoquan He,
	Andrew Morton, Eric DeVolder, open list:KEXEC, open list
  Cc: Petr Tesarik, stable

From: Petr Tesarik <ptesarik@suse.com>

Fix the condition to exclude the elfcorehdr segment from the SHA digest
calculation.

The j iterator is an index into the output sha_regions[] array, not into
the input image->segment[] array. Once it reaches image->elfcorehdr_index,
all subsequent segments are excluded. Besides, if the purgatory segment
precedes the elfcorehdr segment, the elfcorehdr may be wrongly included in
the calculation.

Fixes: f7cc804a9fd4 ("kexec: exclude elfcorehdr from the segment digest")
Cc: stable@kernel.org
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 kernel/kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 3d64290d24c9..3eedb8c226ad 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -752,7 +752,7 @@ static int kexec_calculate_store_digests(struct kimage *image)
 
 #ifdef CONFIG_CRASH_HOTPLUG
 		/* Exclude elfcorehdr segment to allow future changes via hotplug */
-		if (j == image->elfcorehdr_index)
+		if (i == image->elfcorehdr_index)
 			continue;
 #endif
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-09-12  9:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 15:07 [PATCH 1/1] kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y Petr Tesarik
2024-08-05 15:17 ` Petr Tesarik
2024-08-05 22:59 ` Baoquan He
2024-08-16  6:33   ` Petr Tesarik
2024-08-16  7:12 ` Baoquan He
2024-08-16 12:54 ` Eric W. Biederman
2024-08-16 13:42   ` Petr Tesarik
2024-09-12  9:54   ` Baoquan He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox