Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp365303ybj; Sat, 21 Sep 2019 03:16:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7ik7Mls0KmYtbTYWM9m2M1xrfWYxZoDIbfZDK4sH5+oeJSGlCkXyfjbGzGes3AiXHSL56 X-Received: by 2002:a17:906:4b07:: with SMTP id y7mr13218225eju.126.1569060983729; Sat, 21 Sep 2019 03:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569060983; cv=none; d=google.com; s=arc-20160816; b=Kb7Dq7aTEwSnKhXZ2jFUegisZ5Zk9FWDs6sT9l00uK/FGqTkRZODTbh7041s6xz8h0 /i+4g54Jhpmmjef1bjUGjwPDpAhMnHN5zCO+DxH250PZ9AabzN+L0RNI3A1p6MTLBIDU rZUOQ2dBPTuFyvvnGqD92nZR6834Nzkool/cNhD146u7TUztKKA5SyyjQqlp0/nHdljk lJ1OPIzM1xcERVgRSGGTkrSlBA0zVBfs0GrnWvPOumHYy8FX4JQELS+JLvGF+khlKzHN SHC8ni8qQHk6K5DqpDSsLqIBIhf7lc5WAnOHGPSPx/tsiSfjybSwV0M0wTLvVoWX3B43 iYGQ== 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=37AWeNuBJUoYxPX8kfoLGNw4QpswGWY0UHCzy1wiamo=; b=MVD0QSi296A0XxfUbVFcMCXKCo/WPjzpxOvXdmUcvWZ8hpIg+7RXzsQ6Zc3uj3/nUT G1fI2lzS55tlky76TrFPPvscUOPx7nmaERRU3Ve/bOGqo/QTjqdNnBiTRaItBBhSEytj dRNmQp4p7d4y0gogBB52bgbUXBnIjfB/Lm2SKKE/DHIXIFwh99ogsOE5HyCOeWfVGo3z XVlvsV/Ax3UT7ulmIcCgqmxzaSpdH9T6HBcGmDYaWXsybURO5fGkxMARpoVjfmjbalcc 9u8T/xiiHGRh2RW1+42WhSq3cVODqtr++TdZ9TT5C1XKEiXsWnFyO1gAU+nWeD+JBNAR +bHA== 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 s21si2512196ejm.122.2019.09.21.03.15.44; Sat, 21 Sep 2019 03:16: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 S2408499AbfITJZe (ORCPT + 99 others); Fri, 20 Sep 2019 05:25:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2752 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2408489AbfITJZb (ORCPT ); Fri, 20 Sep 2019 05:25:31 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5BE021C00D45B90B9019; Fri, 20 Sep 2019 17:25:29 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Fri, 20 Sep 2019 17:25:19 +0800 From: Jason Yan To: , , , , , , , , CC: , , , , , , , Jason Yan Subject: [PATCH v7 03/12] powerpc: introduce kernstart_virt_addr to store the kernel base Date: Fri, 20 Sep 2019 17:45:37 +0800 Message-ID: <20190920094546.44948-4-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190920094546.44948-1-yanaijie@huawei.com> References: <20190920094546.44948-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 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..4d32d1b561d6 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 kernstart_virt_addr; + #include #endif /* __ASSEMBLY__ */ #include diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c index e223da482c0c..42ef7a6e6098 100644 --- a/arch/powerpc/mm/init-common.c +++ b/arch/powerpc/mm/init-common.c @@ -25,6 +25,8 @@ phys_addr_t memstart_addr __ro_after_init = (phys_addr_t)~0ull; EXPORT_SYMBOL_GPL(memstart_addr); phys_addr_t kernstart_addr __ro_after_init; EXPORT_SYMBOL_GPL(kernstart_addr); +unsigned long kernstart_virt_addr __ro_after_init = KERNELBASE; +EXPORT_SYMBOL_GPL(kernstart_virt_addr); static bool disable_kuep = !IS_ENABLED(CONFIG_PPC_KUEP); static bool disable_kuap = !IS_ENABLED(CONFIG_PPC_KUAP); -- 2.17.2