Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2357508ybh; Sun, 4 Aug 2019 23:27:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyN2plraz/xpQQfDW1J2I2YAHO4UcNv0gxtp/84gOWUjQEc1T6Irtr7UmzanFP/4lHphnyg X-Received: by 2002:a17:902:24b:: with SMTP id 69mr136706964plc.250.1564986449737; Sun, 04 Aug 2019 23:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564986449; cv=none; d=google.com; s=arc-20160816; b=H4H/qPtTwnKHNBQluYGaWe5EL7TvEwLSlM+qwc2JNYuN2sOVjGKEOH6OO+x5YxiuDU GvyLr9ukM8VwKZa+DT0DgHQCY7YnprPMgrNEz5Htg9qDj2BfONwOALAq7oXpV73zGWoc HlKpPPVS8NZAOPBjXooCl0rCYLScWN9iQKcrwaRJusG9PiiWq/TvCj/f9uADKfZk1/CN uplRmyl8x5ffbh2svCHA935phPBExlKGgYYuUEURvO/DQGmfPmn/bVAFBCK/xIvEHBpQ +hB7cc6ZHeUaNIgFQ7ukt5K5f+QYhW+SYRtltMCByXhGIaX1EkpiNtsyogKM5a0mI7Au 6NUA== 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=zwkmlSAIZCOMK3OKX9BEP283j0FZZ44ltqWTl3j2XUc=; b=qJ7tvW0oVedrLJST6t+8LaF28Q5xgBa/Mn5eERgsILg1C/yhNBx+hzwCB+w8umx6i8 B5yPdR4gtY7EYv4Xj9vdFEPn0MNYVFb5qLlwKS68Jl2T61RIoaMdHcJ/hM3BFfv64Mbc 4+jJLpRpIZ806RQMuUnNSL7kti0L5giFlBaV8LbXoO5b97Z7Zv/flo/C9ID46/hovc6x YfZIraT9IbTbAKSHSOaR4WGvZbzRrW5wnGBIjUDOcLrjJp2Js6S8u0SW9f5XhkkiE1qP l6k/iX2k1Z/2Zu4gOjx6oIesSVRrPbvY4Kv+fucrFL7LjXu8kEPK/Vf5AaKUG7pRuPiR p0hg== 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 g13si11919366pgj.498.2019.08.04.23.27.14; Sun, 04 Aug 2019 23:27:29 -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 S1727357AbfHEG0j (ORCPT + 99 others); Mon, 5 Aug 2019 02:26:39 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42462 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727270AbfHEG0i (ORCPT ); Mon, 5 Aug 2019 02:26:38 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3B389BDC3C4B824952CB; Mon, 5 Aug 2019 14:26:37 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Mon, 5 Aug 2019 14:26:28 +0800 From: Jason Yan To: , , , , , , , , CC: , , , , , , , Jason Yan Subject: [PATCH v4 03/10] powerpc: introduce kimage_vaddr to store the kernel base Date: Mon, 5 Aug 2019 14:43:28 +0800 Message-ID: <20190805064335.19156-4-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190805064335.19156-1-yanaijie@huawei.com> References: <20190805064335.19156-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..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