[PATCH 1/1] kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y
Petr Tesarik
ptesarik at suse.com
Thu Aug 15 23:33:49 PDT 2024
On Tue, 6 Aug 2024 06:59:35 +0800
Baoquan He <bhe at redhat.com> wrote:
> On 08/05/24 at 05:07pm, Petr Tesarik wrote:
> > From: Petr Tesarik <ptesarik at 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.
>
> Indeed, good catch.
>
> Acked-by: Baoquan He <bhe at redhat.com>
Thank you, Baoquan.
Who should apply the fix now? How can it be merged into Linus tree?
Petr T
> >
> > Fixes: f7cc804a9fd4 ("kexec: exclude elfcorehdr from the segment digest")
> > Cc: stable at kernel.org
> > Signed-off-by: Petr Tesarik <ptesarik at 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
> >
>
More information about the kexec
mailing list