Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4711782ybi; Tue, 30 Jul 2019 06:53:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIHeDA3/jbMnl2tbmmhPHKBW60AP/YG1n1E9IAMJZ9B86dTcBg1oh04fQkdiFkDEtrULNG X-Received: by 2002:a63:2b84:: with SMTP id r126mr65776989pgr.308.1564494832904; Tue, 30 Jul 2019 06:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564494832; cv=none; d=google.com; s=arc-20160816; b=c2b4aU6g4S2THlitJGyYqXspELlOSo+XNu5O9+6+LAduu9T4N62pAaDa2nizKcHYob VlnVYWmMlFDLQAz47J5Cs1jU4ICvXxaUKaUMLVHM5TDq8eN9M4vW/1rs6eqgZk/40WUo 5DehjP/v0ozG4gsOmDwW+Wwrod+ER0Esn/+wEo+zcWu3H7UhMzIYrQTB90uoaQfLVzkA 36MP28gKN3nJsQOtkrD5FZsPRUJOpsSl+IYxqNFLhbO+z80WViIE26Tz3LRFWsW5syo6 u+ANDSzAoc3hvhxewTZSQ3HCuEjIOSou2zhEmfgQs8g9vHEdWyWe15+3W553G9seMIo0 AzoA== 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=gcgEAMgATwl9/QIZpwf3tQLN8cZ6CrDp3dHqMGcIgsQ=; b=Es66H3FPPKgkKS/oSGhG5OSOJCNFPmWFbr0I8yhn0nophl0KmO8OjuBEyvmuKoou6n 8rDRQ3ZbczzeTc55h/4OlKD8wXzV2DN5utkHBOG7LbYaJI/97dmVQAA3ktjfJcK6v0Vl Npys2nqorD66BAhUHakeUo88mp1HB0BuBCwY0tPBJcchgB8XAt5Ed5c6ZLVwCYY40KnV 4miAx/Nh4B5CchqiMJ0rBj7Q2/QptnDdAKGreSjAEFFOltE2PR4pvtBiIt6VmY2hILYT B6SHKSSwZdLCW3I4AUGhbPPok7fkTlQID/z2ki2ulpY3BB1CjEiyPaedQKsyDwNSWQrC GR4w== 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 k3si25081546pjt.103.2019.07.30.06.53.37; Tue, 30 Jul 2019 06:53:52 -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 S1730081AbfG3HZn (ORCPT + 99 others); Tue, 30 Jul 2019 03:25:43 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3214 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729772AbfG3HZk (ORCPT ); Tue, 30 Jul 2019 03:25:40 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1F43123172E3DF422327; Tue, 30 Jul 2019 15:25:35 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Tue, 30 Jul 2019 15:25:25 +0800 From: Jason Yan To: , , , , , , , , CC: , , , , , , , Jason Yan Subject: [PATCH v2 03/10] powerpc: introduce kimage_vaddr to store the kernel base Date: Tue, 30 Jul 2019 15:42:18 +0800 Message-ID: <20190730074225.39544-4-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190730074225.39544-1-yanaijie@huawei.com> References: <20190730074225.39544-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 --- 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