Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5060310ybh; Tue, 6 Aug 2019 23:41:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8oP0oG+fn4D1c1OHU4t0Griz6k2ktwPIezaZoh/gXe84CvISp7Zw7TELlc8OWZ7kRunhP X-Received: by 2002:a17:902:a60d:: with SMTP id u13mr6891879plq.144.1565160078388; Tue, 06 Aug 2019 23:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565160078; cv=none; d=google.com; s=arc-20160816; b=fM6QG4/0txcKeqstfbKC8xl28LmbUlhV/dPl/4pGWI75stQJ7MpxOlBebVV2r3A+oH Or6IwjT6Oskf5yQUbD+J1DbLkHaAKhBo7Jb2+5wyxGPr7DA+7s/aFi+4efjueAnl/bqQ FQIDkBUxYf7gTaVty6Lb7RVJhvOI3AxAxRC5SxH9yjmMKJUFCieLmefZRZOcdCe5moP8 KBFZoLWeawUTu62xVp3WAyxCMsjTUm4XGkZYdOW8zDv1qstFLq5pxuz8/IaB2Nw5mxZN k8MRiZoeZBSFw3Y+NRHpxIACFgCmFd4RxmqthZZ4HB3+oJDY49AmL7Vx5Jw0GMr8zuz+ GIOA== 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=wqrP+0nVOqqjcA8y9e7AjarBX/M17ZXo6zIfUShhXbwcv+G1dmEkZ1nwyjz+N0JW+5 v+j36widgHrpYBTj09jgzD0qiTLYHGZd98e/b2yhWK+gPt0zCVafz/kRSLcbDzf+rbby q9vLgcHwLe82d9kwOUPnLMNW/u5IRRgGnZ14g+QsWhChlHncK4OeIE2z6N2Q3kV5qOwr 14FWwSoj6Q6+F8lSpqAY67B71amHzMD1hH+jymtYW3DD1kTiMbMx9qpsTRuvgFuu2x/q Qfx/mZX3fLqgrUCFCo0v11bL5HtdJJuDeddsIl1+H9iRactEj2DXPFDq85E0R5Xn6hAC ZQyQ== 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 q38si35480191pgk.63.2019.08.06.23.41.03; Tue, 06 Aug 2019 23:41:18 -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 S1727615AbfHGGkO (ORCPT + 99 others); Wed, 7 Aug 2019 02:40:14 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3773 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727414AbfHGGkL (ORCPT ); Wed, 7 Aug 2019 02:40:11 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 13E6E4788DB2D6498E83; Wed, 7 Aug 2019 14:40:08 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Wed, 7 Aug 2019 14:39:57 +0800 From: Jason Yan To: , , , , , , , , CC: , , , , , , , Jason Yan Subject: [PATCH v5 03/10] powerpc: introduce kimage_vaddr to store the kernel base Date: Wed, 7 Aug 2019 14:56:59 +0800 Message-ID: <20190807065706.11411-4-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190807065706.11411-1-yanaijie@huawei.com> References: <20190807065706.11411-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