Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp309045pxm; Wed, 23 Feb 2022 00:25:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZH9szPSz+LQYyswCJHgiCaPeIFk9j5YVIw+hTodxyGjW3V25o3+i2jHN01Uxgnkc8JeVy X-Received: by 2002:a17:90a:4e47:b0:1bc:190e:c87b with SMTP id t7-20020a17090a4e4700b001bc190ec87bmr8083689pjl.205.1645604759395; Wed, 23 Feb 2022 00:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645604759; cv=none; d=google.com; s=arc-20160816; b=YrtEaRS05qKyxmMWjordPl4Z8K3kBdGrfpKqnF1eTaOzYBM4SvcZ/DTt3Cr0YAUcIO rcJ78KOM2/J+X69PuQTgH5u8fDvJspw5V3S/47NKiGA5VknFjHisn6aQM2xn5i2SAZOE y6LZvZG3wephNNP3bJ0CtzHXLlh4DwBBEkV9YLE1jrA96m0kz2Btzj4lRw7edbqXbwcl W7TX/6Yd0aCFLqFzmayrSX7w2k8H6vE75rQOImqz9Xv8ZNwDWasv8E9+WpCYesw+kuO8 arB64CdwUYmCIDRAOE8zEVut7qJXOldpqDuDg8nTiASmnZ3sp9/LiiSMYnpeBJcIfZ2s cvPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YzQtzaVO1Z4U7y1IenZT534HvM8HDX/vO3aOxWE8Xpc=; b=jiUKX10gdDaP3Lr3z/nvE8MA1Uu1iw2EhmqxDiIQLm8o/4/gg3noR2/hAMkmDXWuUn TTW4RUCs5HeeU70akShibMihpDisepqNUYesFlRtQF3AQFCv5I+Qzra88qAov8i0ypGK MrAiQD1XjWE7lrFSFf6Q7NitNCQhu3kkeyNfbb0Pc84i8KCDNh3J88ueyUEyNnDLywgN 5qMn4cqrd1nwPh0ecHwhDTlYxLcVBn9lp6FXJSgRs5fSd0vvA9f+zSqR5SZ0AtP3a+wi K/xG5rHbnZC1lLXLVexDpQBejtUItqjHe74SnpFEiF5ndrxjfOSlkjbHeTBwXu4pACwa 1tzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T4yWZ8Is; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5si580979pfi.144.2022.02.23.00.25.45; Wed, 23 Feb 2022 00:25:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T4yWZ8Is; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235980AbiBWEBv (ORCPT + 99 others); Tue, 22 Feb 2022 23:01:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231492AbiBWEBt (ORCPT ); Tue, 22 Feb 2022 23:01:49 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 812E6654B9 for ; Tue, 22 Feb 2022 20:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645588881; 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=YzQtzaVO1Z4U7y1IenZT534HvM8HDX/vO3aOxWE8Xpc=; b=T4yWZ8IsEkWa6ChCEIsz3kkbIGXaFQjNizxi673aGNIM3zSycWu5Alna+L+R3cZRCFKBrI Gxb5p2HiduyESAFryBRcBkoe6RBuDyVYCBoYZ+RwzmwPKkeVnb3F9pxbU+FW+ef19LNYee ipj/FMBs4KcfGQRo4d12NIm+65eehWU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-CYAJtxUOOMaCIAG_UD0N-A-1; Tue, 22 Feb 2022 23:01:18 -0500 X-MC-Unique: CYAJtxUOOMaCIAG_UD0N-A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1631F800425; Wed, 23 Feb 2022 04:01:16 +0000 (UTC) Received: from localhost (ovpn-14-1.pek2.redhat.com [10.72.14.1]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9642370129; Wed, 23 Feb 2022 04:00:59 +0000 (UTC) Date: Wed, 23 Feb 2022 12:00:57 +0800 From: Baoquan He To: Eric DeVolder Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, ebiederm@xmission.com, dyoung@redhat.com, vgoyal@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, nramas@linux.microsoft.com, thomas.lendacky@amd.com, robh@kernel.org, efault@gmx.de, rppt@kernel.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com Subject: Re: [PATCH v4 07/10] crash hp: exclude elfcorehdr from the segment digest Message-ID: References: <20220209195706.51522-1-eric.devolder@oracle.com> <20220209195706.51522-8-eric.devolder@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220209195706.51522-8-eric.devolder@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/09/22 at 02:57pm, Eric DeVolder wrote: > When a crash kernel is loaded via the kexec_file_load syscall, the > kernel places the various segments (ie crash kernel, crash initrd, > boot_params, elfcorehdr, purgatory, etc) in memory. For those > architectures that utilize purgatory, a hash digest of the segments > is calculated for integrity checking. This digest is embedded into > the purgatory image prior to placing purgatory in memory. > > Since hotplug events cause changes to the elfcorehdr, purgatory > integrity checking fails (at crash time, and no kdump created). > As a result, this change explicitly excludes the elfcorehdr segment > from the list of segments used to create the digest. By doing so, > this permits changes to the elfcorehdr in response to hotplug events, > without having to also reload purgatory due to the change to the > digest. Acked-by: Baoquan He > > Signed-off-by: Eric DeVolder > --- > kernel/kexec_file.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index 801d0d0a5012..93bb0c0ce66c 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -765,6 +765,12 @@ static int kexec_calculate_store_digests(struct kimage *image) > for (j = i = 0; i < image->nr_segments; i++) { > struct kexec_segment *ksegment; > > +#ifdef CONFIG_CRASH_HOTPLUG > + /* This segment excluded to allow future changes via hotplug */ > + if (image->elf_index_valid && (j == image->elf_index)) > + continue; > +#endif > + > ksegment = &image->segment[i]; > /* > * Skip purgatory as it will be modified once we put digest > -- > 2.27.0 >