Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp82252ybl; Fri, 9 Aug 2019 02:52:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZYXGBIpEmNWuxa1HO2DnVFLzmZ5Oir2R3aq5qpW7GB67fJkdZ1Ugw66qxVVnvnob5tv4A X-Received: by 2002:aa7:8619:: with SMTP id p25mr20244411pfn.220.1565344375219; Fri, 09 Aug 2019 02:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565344375; cv=none; d=google.com; s=arc-20160816; b=Gwy8HiKMT8a9VXMDJNZ3iVAbwXqWl51DoilR6ybzSnfl/GQDia05l21k+lZQOsKFpv dnSqStBtpthvHVVsGznTZfVYW5vLw/BAnB5Wvt/z62W06LEffbK9mUCqEkWO1yJlnO0b 7PiIzvmDw/m74Ls1TIOA/plMUHHu/XGJrK1vyv8LN7I1pwYn0Z98/aNdPNt7MlYx5Bmp eqjXdPy9vu+howb8S36HoTQjeFhtHzUKMaDMzQ3lGtWfAnGmVXjpt9c/PUb/MtW47VIy QZTDox2MCkVZqqZhb6AkMt1HDpCP8/q4i4Rcz4MfxkWE/1CZo26jYjqxo62iumZEyr0w JG3g== 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=FjL2OI3k2B7ddtTwI/1qFrFY7AyuU818gUdVkeBNWPVDO+km/jC5QW/Iryz4FhmcvF aDkcFWnMBPgJuPMgq9/XznYVXFpHNZ7N8dnLYGF/QoD3ZBflsKK+GPdylaM/PNAts5q5 MaidMCjdB7Qhw1Vp72eujXaKYXV2JqqUFm9NW8ZnaiWivof0sWkCSqo8hwMXga1ovOUT 3Caf/9MfPwt+cNdxsJE+NYp1lylimw1rwOjEGqXS3N7E1URr62LkXL6iZVzug1ZK/skp bsCYZrpWl9MnxttSnluvEF5d+g/a+U3QIo64lnt52lWsZR3t4AKKTLy7xA4trgSup9bQ DKyg== 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 m5si47870753plt.167.2019.08.09.02.52.39; Fri, 09 Aug 2019 02:52:55 -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 S2406063AbfHIJwA (ORCPT + 99 others); Fri, 9 Aug 2019 05:52:00 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4217 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732885AbfHIJv7 (ORCPT ); Fri, 9 Aug 2019 05:51:59 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2F6FE46AAED47B7556F8; Fri, 9 Aug 2019 17:51:58 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Fri, 9 Aug 2019 17:51:51 +0800 From: Jason Yan To: , , , , , , , , CC: , , , , , , , Jason Yan Subject: [PATCH v6 03/12] powerpc: introduce kernstart_virt_addr to store the kernel base Date: Fri, 9 Aug 2019 18:07:51 +0800 Message-ID: <20190809100800.5426-4-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190809100800.5426-1-yanaijie@huawei.com> References: <20190809100800.5426-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