Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5437544ybh; Wed, 7 Aug 2019 06:04:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfa5oERECnHs15mwZtoNT/f0QVMzmuEvd1R2eUkeCOMjpQZfey/LKU0PRI1PgeMGTKOfOQ X-Received: by 2002:a62:6d84:: with SMTP id i126mr9002279pfc.129.1565183097878; Wed, 07 Aug 2019 06:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565183097; cv=none; d=google.com; s=arc-20160816; b=SLqpqleV3PKFQ9u1LioCJwnNkqBlokKjCF4acBId1xAGEslhVZLb+zBAKTFqq5zZVS p811hfKmKqpw0VYXJ+Uzn0mlAUIQWjHkPSQE6ZPf71k2vx7QVSfv2d3Y11bxK3CqOiOQ q1o5TV3LU6NizfWc0sgODo7E2vRRGaf0U/uKRQzzAATEPX9ETJTYRe3lgwzKnNzEWYGi Bb9noGHIdQ+iNk+c2k+zRVVdFXnpn2YF3v7x6dOc5eY4iRGq4MxccpCrddn20G1qfpmh 6byW5t3B6TtLxXF8UUTNzXvfHdNMac8nSde8+V+KWvR/81EWeBal5Htrx0Wcv8fwyKFM BdRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=xtkZb1XGF/VM5KdDrYjVXTLzwr4700WOe6pOgoNbRw0=; b=uE6Yf7q669wrsGPyyWRWhnAkAUSSiguNoeNIjLYvkZzbFx9YA6IF9tKTSgBsdUOHv2 zojSNMDIlg838U4VTWEAnJafg51maODJAE07nstOK30f0yG0w3lL03cKWL0L+VoljntX hYyazht5AviQxUlOQrv1mpZs5wxIKDOvnA7rOdoWKFHNjWKaIgFs+eXb1nCPIKSTq8XY wE1OH6w/hcuayGDvK2E+y1bZ28vtJtDSChPV3WjhiLN1HhL3/2uuwg3IGZwsuTYj8QZY E6AqLNwq8dCsb7tRSNGXrM+Rzxs6nmdCXpaMwGyOjXfpPw++RthdPY+lVeGk0rdCzcfU O4rA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si7410166pgn.367.2019.08.07.06.04.41; Wed, 07 Aug 2019 06:04:57 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388058AbfHGNDb (ORCPT + 99 others); Wed, 7 Aug 2019 09:03:31 -0400 Received: from ozlabs.org ([203.11.71.1]:46493 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbfHGND3 (ORCPT ); Wed, 7 Aug 2019 09:03:29 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 463WsC1bBxz9sBF; Wed, 7 Aug 2019 23:03:27 +1000 (AEST) From: Michael Ellerman To: Jason Yan , linuxppc-dev@lists.ozlabs.org, diana.craciun@nxp.com, christophe.leroy@c-s.fr, benh@kernel.crashing.org, paulus@samba.org, npiggin@gmail.com, keescook@chromium.org, kernel-hardening@lists.openwall.com Cc: linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com, yebin10@huawei.com, thunder.leizhen@huawei.com, jingxiangfeng@huawei.com, fanchengyang@huawei.com, zhaohongjiang@huawei.com, Jason Yan Subject: Re: [PATCH v5 03/10] powerpc: introduce kimage_vaddr to store the kernel base In-Reply-To: <20190807065706.11411-4-yanaijie@huawei.com> References: <20190807065706.11411-1-yanaijie@huawei.com> <20190807065706.11411-4-yanaijie@huawei.com> Date: Wed, 07 Aug 2019 23:03:23 +1000 Message-ID: <8736idunz8.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jason Yan writes: > Now the kernel base is a fixed value - KERNELBASE. To support KASLR, we > need a variable to store the kernel base. > > Signed-off-by: Jason Yan > Cc: Diana Craciun > Cc: Michael Ellerman > Cc: Christophe Leroy > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Nicholas Piggin > Cc: Kees Cook > Reviewed-by: Christophe Leroy > Reviewed-by: Diana Craciun > Tested-by: Diana Craciun > --- > arch/powerpc/include/asm/page.h | 2 ++ > arch/powerpc/mm/init-common.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h > index 0d52f57fca04..60a68d3a54b1 100644 > --- a/arch/powerpc/include/asm/page.h > +++ b/arch/powerpc/include/asm/page.h > @@ -315,6 +315,8 @@ void arch_free_page(struct page *page, int order); > > struct vm_area_struct; > > +extern unsigned long kimage_vaddr; > + > #include > #endif /* __ASSEMBLY__ */ > #include > diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c > index 152ae0d21435..d4801ce48dc5 100644 > --- a/arch/powerpc/mm/init-common.c > +++ b/arch/powerpc/mm/init-common.c > @@ -25,6 +25,8 @@ phys_addr_t memstart_addr = (phys_addr_t)~0ull; > EXPORT_SYMBOL_GPL(memstart_addr); > phys_addr_t kernstart_addr; > EXPORT_SYMBOL_GPL(kernstart_addr); > +unsigned long kimage_vaddr = KERNELBASE; > +EXPORT_SYMBOL_GPL(kimage_vaddr); The names of the #defines and variables we use for these values are not very consistent already, but using kimage_vaddr makes it worse I think. Isn't this going to have the same value as kernstart_addr, but the virtual rather than physical address? If so kernstart_virt_addr would seem better. cheers