Received: by 10.223.185.116 with SMTP id b49csp3578642wrg; Mon, 26 Feb 2018 02:25:28 -0800 (PST) X-Google-Smtp-Source: AH8x224DWafVWbcxBJMPYCmgajzJ0fzl836DPmIi4/ReiVkrmiQNx76dvutK47cDZZsPeGyisdtd X-Received: by 10.101.99.133 with SMTP id h5mr7826625pgv.381.1519640728852; Mon, 26 Feb 2018 02:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519640728; cv=none; d=google.com; s=arc-20160816; b=r+I9mpkTESO3YvYMjQLv4k89Dy12uxdFFqS76COzk9amLq+0H9Og0rs3dFdLJbNBb2 dS/j6Ah0MyzyGDmN1hMdLbyo1t/oZpkoq7itoBulibMNXg/qjTsiZn2eB7UWY93iA32V HHi1exPRh9d0I4QiUxfG4xOmuVL0Ffs3EtERI1hxRWjvZ6zNYh9FrdS8PckbraF6ogDY RmZ7e8KILmRRysF14Tjq35lJYEXJU3C7bAe+ytCA5ysdO6ThDrsqh6F3fXmeHxo6tJvk f2tupWXfuHR3iWxPyDV0fXEkahz6Fl4V2eXJciclO7WMV72FH2ztPPXXiYGZNciOhS7k FVqw== 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=doAuQHQv7afWxjyMSM204Co/VmzIwfBSz2aUKOdN+yk=; b=I+idmHrNs38lxBSfhUNWqVtdh3VKGRpNfkcfqhCfI8O5Fd645fx/MwiOgECs+/oE5D rh75zPt8GdnKPCUlap4HjXmtYSzlaRCx+/mKCL8yD39bvtGNPubMf0r7gGQbsPvyuNi5 g/Fw82W0gC5rG7AE7ZV28zTbk/4S5XZM9tH/jEpq91oXOtKzX/Mev4OgQnKJMUxHimcD 9dhrjgyCGH/NAlgYiEYHWoQnlOgBCIYURw3mt/R95VXx7gI/nA8nGm5bt+fDTGPetbcL roGN5MxdmnW52g9V5dn3OiD52rfTEMsDAbZvPtIpmBkcug0OahCypvECUQp8hjskgcK9 2GZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gh5d3gwc; 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 z11si5383418pgr.170.2018.02.26.02.25.13; Mon, 26 Feb 2018 02:25:28 -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=Gh5d3gwc; 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 S1752448AbeBZKYU (ORCPT + 99 others); Mon, 26 Feb 2018 05:24:20 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:43763 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752324AbeBZKYQ (ORCPT ); Mon, 26 Feb 2018 05:24:16 -0500 Received: by mail-io0-f195.google.com with SMTP id l12so16662820ioc.10 for ; Mon, 26 Feb 2018 02:24:16 -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=doAuQHQv7afWxjyMSM204Co/VmzIwfBSz2aUKOdN+yk=; b=Gh5d3gwc5vyK3nIH8/cdICX/pv65Vh2fOqC52sW/DI0XGS5FXXxYqXzVa+0EDa/lvf 51KQw1Gd4VHB+scNo3hhEiBdSXykmKtHGcZmzR+dqXMq1t4xac/nMzG05oU9tHwt9HhH KkLZyLRLzX7pkLsUtMob4gZ0+v1SF+EMIUpRI= 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=doAuQHQv7afWxjyMSM204Co/VmzIwfBSz2aUKOdN+yk=; b=njYqBEP8p8KxzXRxbiUHb2GSZgMXlY2EkQp2I1gDba4rTcIPj30zwRxI7gzbA/K1zp flkzI7sgou2pzIkd6HgJTMh3rbbA9UugsmmVrX610Zdo6CW4nCBw9NnRxOoOLVtedi1a MdTrIC6+FkWjZyB8IMT6f5xL+MAT777rTGtqg8GcHrQ90dZKQqcfwREkkLLB4/zEd+34 in2fndBYYEODzwkQOOpVtxRH4iXgv3jT5cI/tywwelGLCza5znAC0+cf5QnT87X29eDS 2FxLrrKH27JxmTJD7eUKnh4PBu8/y2V5/fwEZ5Cxl9W0cNP7A/eV3P/+mGjjxb8iR+Z5 6bfw== X-Gm-Message-State: APf1xPDCHh1QR9M2+p1SZzt2T3kXiu9HvW/965LLdQ8dDEn9a4eA3G7n JjHfAU3BaZLRp/PATkeW39nR3w== X-Received: by 10.107.157.65 with SMTP id g62mr11734649ioe.108.1519640656309; Mon, 26 Feb 2018 02:24:16 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id v8sm4990684itv.3.2018.02.26.02.24.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 02:24:15 -0800 (PST) Date: Mon, 26 Feb 2018 19:24:19 +0900 From: AKASHI Takahiro To: Dave Young Cc: catalin.marinas@arm.com, will.deacon@arm.com, bauerman@linux.vnet.ibm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, mpe@ellerman.id.au, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, julien.thierry@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 02/13] kexec_file: make an use of purgatory optional Message-ID: <20180226102418.GD6019@linaro.org> Mail-Followup-To: AKASHI Takahiro , Dave Young , catalin.marinas@arm.com, will.deacon@arm.com, bauerman@linux.vnet.ibm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, mpe@ellerman.id.au, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, julien.thierry@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20180222111732.23051-1-takahiro.akashi@linaro.org> <20180222111732.23051-3-takahiro.akashi@linaro.org> <20180223084934.GB4433@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180223084934.GB4433@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, Feb 23, 2018 at 04:49:34PM +0800, Dave Young wrote: > Hi AKASHI, > > On 02/22/18 at 08:17pm, AKASHI Takahiro wrote: > > On arm64, no trampline code between old kernel and new kernel will be > > required in kexec_file implementation. This patch introduces a new > > configuration, ARCH_HAS_KEXEC_PURGATORY, and allows related code to be > > compiled in only if necessary. > > Here also need the explanation about why no purgatory is needed, it would be > required for kexec if no strong reason. OK, I will add the reason: 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. So our key developers think that it is highly unlikely that the region is accidentally corrupted and this rationalizes that digest check code be also dropped from purgatory. This greatly simplifies our purgatory without any need for a bit ugly relocation stuff, i.e. arch_kexec_apply_relocations_add(). Please see: http://lists.infradead.org/pipermail/linux-arm-kernel/2017-December/545428.html to find out how simple our purgatory was. All that it does is to shuffle arguments and jump into a new kernel. Without this patch, we would have to have purgatory with a space for a hash value (purgatory_sha256_digest) which is never checked against. Do you think it makes sense? Thanks, -Takahiro AKASHI > > > > 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 > > > > Thanks > Dave