From: Baoquan He <bhe@redhat.com>
To: Petr Tesarik <petr.tesarik@suse.com>
Cc: Eric Biederman <ebiederm@xmission.com>,
Sourabh Jain <sourabhjain@linux.ibm.com>,
Hari Bathini <hbathini@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Eric DeVolder <eric.devolder@oracle.com>,
"open list:KEXEC" <kexec@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>,
Petr Tesarik <ptesarik@suse.com>,
stable@kernel.org
Subject: Re: [PATCH 1/1] kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y
Date: Tue, 6 Aug 2024 06:59:35 +0800 [thread overview]
Message-ID: <ZrFZM4W7S89VpfaG@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20240805150750.170739-1-petr.tesarik@suse.com>
On 08/05/24 at 05:07pm, Petr Tesarik wrote:
> 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.
Indeed, good catch.
Acked-by: Baoquan He <bhe@redhat.com>
>
> 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
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
WARNING: multiple messages have this Message-ID (diff)
From: Baoquan He <bhe@redhat.com>
To: Petr Tesarik <petr.tesarik@suse.com>
Cc: Eric Biederman <ebiederm@xmission.com>,
Sourabh Jain <sourabhjain@linux.ibm.com>,
Hari Bathini <hbathini@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Eric DeVolder <eric.devolder@oracle.com>,
"open list:KEXEC" <kexec@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>,
Petr Tesarik <ptesarik@suse.com>,
stable@kernel.org
Subject: Re: [PATCH 1/1] kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y
Date: Tue, 6 Aug 2024 06:59:35 +0800 [thread overview]
Message-ID: <ZrFZM4W7S89VpfaG@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20240805150750.170739-1-petr.tesarik@suse.com>
On 08/05/24 at 05:07pm, Petr Tesarik wrote:
> 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.
Indeed, good catch.
Acked-by: Baoquan He <bhe@redhat.com>
>
> 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
>
next prev parent reply other threads:[~2024-08-05 23:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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:07 ` Petr Tesarik
2024-08-05 15:17 ` Petr Tesarik
2024-08-05 15:17 ` Petr Tesarik
2024-08-05 22:59 ` Baoquan He [this message]
2024-08-05 22:59 ` Baoquan He
2024-08-16 6:33 ` Petr Tesarik
2024-08-16 6:33 ` Petr Tesarik
2024-08-16 7:12 ` Baoquan He
2024-08-16 7:12 ` Baoquan He
2024-08-16 12:54 ` Eric W. Biederman
2024-08-16 12:54 ` Eric W. Biederman
2024-08-16 13:42 ` Petr Tesarik
2024-08-16 13:42 ` Petr Tesarik
2024-09-12 9:54 ` Baoquan He
2024-09-12 9:54 ` Baoquan He
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=ZrFZM4W7S89VpfaG@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=eric.devolder@oracle.com \
--cc=hbathini@linux.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petr.tesarik@suse.com \
--cc=ptesarik@suse.com \
--cc=sourabhjain@linux.ibm.com \
--cc=stable@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.