From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8168CC3DA7F for ; Mon, 5 Aug 2024 23:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DW5a7mh0bgygjcBRChHLxC9NG43MRtudAS5uXpbMEik=; b=Z2o8CplT0WvpPZ OuekX+u/L14tDg1K96OuJwHnw3kSQ4BfN88LzR/JukZr7AN7/unGsorGV2GAje2LM9rvwKPKFrdqj dSWe7GBq79gKAM0ybL6T8gmrgRE6TgnpbiD4aa+oEjT+yMSBzaVLnqBLjEjBaL1uxBAFoTffjJ0Wh gFB1vZT9s/pADjCBztRGtwfV6I0Uy23tZrO1KHAk19S5w93vy4ARjnJfWfmQk51DZ8w4niM+GtZ+K q/he6Qz+xjQn3THRbj2J03cptO+6oYjdSwoYrj7eP3MnHlI/DdIYQgieXM0asqY7+zhRjRKFKUNni wPguPX6OxqALwi7D04xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb6gK-0000000HVQF-3TJS; Mon, 05 Aug 2024 23:00:00 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb6gH-0000000HVOT-2bev for kexec@lists.infradead.org; Mon, 05 Aug 2024 22:59:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722898795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KeKM9Izq3y/FBXidwLJnO4fZinQDYnhnSVbYAoKkSfc=; b=MNK2bYcaISkE+2KBzYAZri+GEJeEj+YDoAwYT522ziJGEnJJldfD3+uuVfODcp70UsWg4e uPm9jcWhnbgaQOaicm4WjpkeQNXvg/zEQi589U3IDeKrN5UODf/IoAp9Pvht+MZviRkJKU ElDe69wpTBfeX00NH0lOqXOPtgN3cIk= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-SWVVVx7EMgyeSb4b4CeoeA-1; Mon, 05 Aug 2024 18:59:51 -0400 X-MC-Unique: SWVVVx7EMgyeSb4b4CeoeA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A0F331955D55; Mon, 5 Aug 2024 22:59:43 +0000 (UTC) Received: from localhost (unknown [10.72.112.21]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A5481955F40; Mon, 5 Aug 2024 22:59:40 +0000 (UTC) Date: Tue, 6 Aug 2024 06:59:35 +0800 From: Baoquan He To: Petr Tesarik Cc: Eric Biederman , Sourabh Jain , Hari Bathini , Andrew Morton , Eric DeVolder , "open list:KEXEC" , open list , Petr Tesarik , stable@kernel.org Subject: Re: [PATCH 1/1] kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y Message-ID: References: <20240805150750.170739-1-petr.tesarik@suse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240805150750.170739-1-petr.tesarik@suse.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_155957_750119_ADEFAFBA X-CRM114-Status: GOOD ( 17.51 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org On 08/05/24 at 05:07pm, Petr Tesarik wrote: > From: Petr Tesarik > > 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 > > Fixes: f7cc804a9fd4 ("kexec: exclude elfcorehdr from the segment digest") > Cc: stable@kernel.org > Signed-off-by: Petr Tesarik > --- > 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