Received: by 10.223.185.116 with SMTP id b49csp8365212wrg; Thu, 1 Mar 2018 23:56:15 -0800 (PST) X-Google-Smtp-Source: AG47ELuwNZS1IBshJ8SDGeWBAlDm9BQae2mjjXyuYDCesJpb2ebk83MTp2yEu8vzlQ8wGG2Wjh3v X-Received: by 10.98.198.146 with SMTP id x18mr4826773pfk.22.1519977375438; Thu, 01 Mar 2018 23:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519977375; cv=none; d=google.com; s=arc-20160816; b=ixq7PF1a49FoozYdqabz2w/EbQ9WChwR1NP3MEiTYiEGiEEOdEhB9zAgi5FZZBnUi5 HWuC+bcJ6+3q/ZbW5S01Use+8/iHPSRlVBGEnbc3qCdkXvMFghZlFAJ0iUt/Yb7YFKCs hmV+pJ6ENgCE4I2M2doHICmPWt1DClEXzUUlbfFdM63Pkr3aQIc/3UKwVq/g10OTD2/i 5AFFgrVB/eqHt6aFVKTqLM4bI4UIRWKFqOsfaREx3PYs1419fk7FrC88qaXhDwV/tYeO IkItAA/Lk9b67Q5cHX8d3BSnyglaIlZztmgHRKPfyps3LWf6tipzU2VlVxPWX4qJJak5 6xtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=uk+7QjXEZpF8jHNc0n4DVz9pGdaOMHwCzwo7nC72x60=; b=OBjUpNGZ0gTqJUNVaIovQDZLc6gV2FcYv+GPVtKg7JF2ro2YiFbi0ibcQk2kEGQdDP S5UM6epsWoW5/0z7vidWdXXE4XHTpH4RGQO0RSRd88XnPY/JjatzomSAqf0eGmPz0BNQ WVgohLoxy1WDtxFt32IwYfWhgwbDlfg3o5kfKnNqGbmJoUZo7ADDJ8dBd3JEX+M0CB3X kfqs0JEvZv9eIsS58dacVLMJBGHqHU6eUHWWmwLUDKNTVK3F9XYT3z98R2mQahZGE+Ar u/4/+TPbaSyOiNr8hpBeFivS4gMsOL7IbHp29FLGlFu5e25Ut29oA86RyC4NP4VypbcH +MlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I4NiR3nI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13si3674910pgv.110.2018.03.01.23.56.00; Thu, 01 Mar 2018 23:56:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I4NiR3nI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034193AbeCBH0s (ORCPT + 99 others); Fri, 2 Mar 2018 02:26:48 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33028 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932820AbeCBH0o (ORCPT ); Fri, 2 Mar 2018 02:26:44 -0500 Received: by mail-pg0-f68.google.com with SMTP id g12so3440881pgs.0 for ; Thu, 01 Mar 2018 23:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uk+7QjXEZpF8jHNc0n4DVz9pGdaOMHwCzwo7nC72x60=; b=I4NiR3nI9F1L+rTLS5+X5wncpHJp2Ir0KVSGul6W6zwo5loVSdoaaGKPwajTSLk+mc aMRooLOfpDu3BRiYO8G+6Bpe5kbRFUO6X3Y9M8Ckfot6Fv/siMykyrPpVGR3BV85ECZ+ 31R6UshqvYFbXhFnJbcF3vw1MxlUUsxrrfS/w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=uk+7QjXEZpF8jHNc0n4DVz9pGdaOMHwCzwo7nC72x60=; b=rEk/DIl5BEp/cVQcj1DYSiC3+1jQltuKbu6EDgRZB144Kz+34oJ+nfreCWNyXaybeh C/xRAEvG2Yb9F6kZSyIpv+GGnQvh7cR6sC4rqHwqkRuariOnwAJXk5D+HePL4xcUeMsl M2fzjjDJ9IG4ZbJkrDZppo5Qi9bJw16KcZpiTGDkdrzZnlPb4YZzbWM2tSsD3Te4+iIa Z3hCe8ZYAvEEB/YY6kwhLqh9wig+Ns8B4BfVXChSX5v3bHxDJpUvCbfFX9UHiulphQpe aVzQhdf3Ctg7N3dR4GLwuSIHWm7a9+J+oWajL6OkoDuIq6FO+cwuX6o36jm01iJKy9NH r3sQ== X-Gm-Message-State: APf1xPCNFbca/vJzkgZI1pYVH3IjmbUe91HziRc2I96a/sjudIokFSDK Q/3MEjlJ6xiIcmavqRZ6c3N0sA== X-Received: by 10.98.249.76 with SMTP id g12mr4788937pfm.76.1519975604148; Thu, 01 Mar 2018 23:26:44 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id b5sm12103292pfc.12.2018.03.01.23.26.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 23:26:43 -0800 (PST) Date: Fri, 2 Mar 2018 16:26:56 +0900 From: AKASHI Takahiro To: Dave Young Cc: vgoyal@redhat.com, bhe@redhat.com, mpe@ellerman.id.au, bauerman@linux.vnet.ibm.com, prudo@linux.vnet.ibm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH 1/7] kexec_file: make an use of purgatory optional Message-ID: <20180302072655.GT6019@linaro.org> Mail-Followup-To: AKASHI Takahiro , Dave Young , vgoyal@redhat.com, bhe@redhat.com, mpe@ellerman.id.au, bauerman@linux.vnet.ibm.com, prudo@linux.vnet.ibm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org References: <20180227044814.24808-1-takahiro.akashi@linaro.org> <20180227044814.24808-2-takahiro.akashi@linaro.org> <20180302055859.GB15422@dhcp-128-65.nay.redhat.com> <20180302061114.GE15422@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180302061114.GE15422@dhcp-128-65.nay.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 02, 2018 at 02:11:14PM +0800, Dave Young wrote: > On 03/02/18 at 01:58pm, Dave Young wrote: > > On 02/27/18 at 01:48pm, AKASHI Takahiro wrote: > > > On arm64, crash dump kernel's usable memory is protected by > > > *unmapping* it from kernel virtual space unlike other architectures > > > where the region is just made read-only. It is highly unlikely that > > > the region is accidentally corrupted and this observation rationalizes > > > that digest check code can also be dropped from purgatory. > > > The resulting code is so simple as it doesn't require a bit ugly > > > re-linking/relocation stuff, i.e. arch_kexec_apply_relocations_add(). > > > > > > Please see: > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2017-December/545428.html > > > All that the purgatory does is to shuffle arguments and jump into a new > > > kernel, while we still need to have some space for a hash value > > > (purgatory_sha256_digest) which is never checked against. > > > > > > As such, it doesn't make sense to have trampline code between old kernel > > > and new kernel on arm64. > > > > > > This patch introduces a new configuration, ARCH_HAS_KEXEC_PURGATORY, and > > > allows related code to be compiled in only if necessary. > > > > > > Signed-off-by: AKASHI Takahiro > > > Cc: Dave Young > > > Cc: Vivek Goyal > > > Cc: Baoquan He > > > --- > > > arch/powerpc/Kconfig | 3 +++ > > > arch/x86/Kconfig | 3 +++ > > > kernel/kexec_file.c | 6 ++++++ > > > 3 files changed, 12 insertions(+) > > > > > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > > > index 73ce5dd07642..c32a181a7cbb 100644 > > > --- a/arch/powerpc/Kconfig > > > +++ b/arch/powerpc/Kconfig > > > @@ -552,6 +552,9 @@ config KEXEC_FILE > > > for kernel and initramfs as opposed to a list of segments as is the > > > case for the older kexec call. > > > > > > +config ARCH_HAS_KEXEC_PURGATORY > > > + def_bool KEXEC_FILE > > > + > > > config RELOCATABLE > > > bool "Build a relocatable kernel" > > > depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE)) > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > > index c1236b187824..f031c3efe47e 100644 > > > --- a/arch/x86/Kconfig > > > +++ b/arch/x86/Kconfig > > > @@ -2019,6 +2019,9 @@ config KEXEC_FILE > > > for kernel and initramfs as opposed to list of segments as > > > accepted by previous system call. > > > > > > +config ARCH_HAS_KEXEC_PURGATORY > > > + def_bool KEXEC_FILE > > > + > > > config KEXEC_VERIFY_SIG > > > bool "Verify kernel signature during kexec_file_load() syscall" > > > depends on KEXEC_FILE > > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > > > index e5bcd94c1efb..990adae52151 100644 > > > --- a/kernel/kexec_file.c > > > +++ b/kernel/kexec_file.c > > > @@ -26,7 +26,11 @@ > > > #include > > > #include "kexec_internal.h" > > > > > > +#ifdef CONFIG_ARCH_HAS_KEXEC_PURGATORY > > > static int kexec_calculate_store_digests(struct kimage *image); > > > +#else > > > +static int kexec_calculate_store_digests(struct kimage *image) { return 0; }; > > > +#endif > > > > > > /* Architectures can provide this probe function */ > > > int __weak arch_kexec_kernel_image_probe(struct kimage *image, void *buf, > > > @@ -520,6 +524,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf) > > > return 0; > > > } > > > > > > +#ifdef CONFIG_ARCH_HAS_KEXEC_PURGATORY > > > /* Calculate and store the digest of segments */ > > > static int kexec_calculate_store_digests(struct kimage *image) > > > { > > > @@ -1022,3 +1027,4 @@ int kexec_purgatory_get_set_symbol(struct kimage *image, const char *name, > > > > > > return 0; > > > } > > > +#endif /* CONFIG_ARCH_HAS_KEXEC_PURGATORY */ > > > -- > > > 2.16.2 > > > > > > > For this one, I think purgatory digest verification is still good to > > have, but I do not insist since this is arch specific. > > > > If nobody else objects then I think I can ack the series after some > > testing passed. > > For the #ifdefs, they can be changed to IS_ENABLED like other similar > thing. Ah, OK. /* Calculate and store the digest of segments */ static int kexec_calculate_store_digests(struct kimage *image) { if (IS_ENABLED(ARCH_HAS_PURGATORY)) { /* ... */ } else { return 0; } } Many thanks, -Takahiro AKASHI > > > > > Thanks > > Dave