Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5789000ybi; Wed, 31 Jul 2019 03:22:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGn8lRfo2H+akl3mQdKr10Ago10D3zyhSzDiK62LPpsSw2LbTHYpYGU6lC1C/PbPDgKPOf X-Received: by 2002:a17:90a:974b:: with SMTP id i11mr2184946pjw.21.1564568543638; Wed, 31 Jul 2019 03:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564568543; cv=none; d=google.com; s=arc-20160816; b=dkTe899+eXY4jxG6rkV9I2mPv3TPV7+kyBkZR4pVAwfVXRbtqzL3orrdI5/x+FP5Dj sNDMXgAR8TQNI/6DS5vPd4FYF/ZjVYAib35h1Js4Sm6zEoTbIgVRQcQXfdumQkUt1moy vwH64BnZ5lr19Yyr/ml7BIE9Rtky8SG75xlkvu7dhubwRQL85vWwMUt7a1y8LT8AFDbQ 6XgZQmVBNJRnelCnGPLO8oGdGcAnEV3EoPM49Ew4Yy9cv6K/yuWiVrB+CfkuEqTQ7cym G/2CXDHTmPkEj0Lz7iza6V/VC6TaA4KHm6M3g+sR4TrUkUt3efFosYWWDF1T7+hgfSly /B/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=MKeRZfkP5tyMM3JJLusOTMlwb12om2ohzSYG/NPf9kw=; b=YO4+zxdwArjlyee05MtcJig3DYuL3MTcB/EuJjy7gCtwO4Bp+/waXbwC13XuXd7VXu fpK1k60kG2sk/hNvT2zME5XiM+QAMzv3RqXNmiR2679W+jITaaDGhYp32yQo7uwyg2/E K/51RcPtt5wVDypeui7obuJTKyUDJVimR8XmHXkr689YzF2IEjgqFqHXoAGmwZ/IQujb GoVt+ePoVHmJneGzPJ4b9UWYIjQDpSvSjk8/Gen0H6leZqKo+vU+ukgaGP2+YiAK1ROb tnmlKTDxhqTV96K6vEso0GwTgl3Kw3q1W65g+XnqGoHqk+j/uhTGfAeEqO7BspvbO7P1 Ah5g== 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 s101si1207428pjc.54.2019.07.31.03.22.08; Wed, 31 Jul 2019 03:22:23 -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 S1728737AbfGaJ0W (ORCPT + 99 others); Wed, 31 Jul 2019 05:26:22 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3264 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728176AbfGaJ0U (ORCPT ); Wed, 31 Jul 2019 05:26:20 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6B1F77888A269177A741; Wed, 31 Jul 2019 17:26:18 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Wed, 31 Jul 2019 17:26:11 +0800 From: Jason Yan To: , , , , , , , , CC: , , , , , , , Jason Yan Subject: [PATCH v3 03/10] powerpc: introduce kimage_vaddr to store the kernel base Date: Wed, 31 Jul 2019 17:43:11 +0800 Message-ID: <20190731094318.26538-4-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190731094318.26538-1-yanaijie@huawei.com> References: <20190731094318.26538-1-yanaijie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); static bool disable_kuep = !IS_ENABLED(CONFIG_PPC_KUEP); static bool disable_kuap = !IS_ENABLED(CONFIG_PPC_KUAP); -- 2.17.2