From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932740AbdJKI2O (ORCPT ); Wed, 11 Oct 2017 04:28:14 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7552 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757325AbdJKI2F (ORCPT ); Wed, 11 Oct 2017 04:28:05 -0400 From: Abbott Liu To: , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , , Subject: [PATCH 07/11] Avoid cleaning the KASan shadow area's mapping table Date: Wed, 11 Oct 2017 16:22:23 +0800 Message-ID: <20171011082227.20546-8-liuwenliang@huawei.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171011082227.20546-1-liuwenliang@huawei.com> References: <20171011082227.20546-1-liuwenliang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.54.198] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.59DDD542.0004,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9d9007ed0b59f11ac2f7d35844ec4231 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Ryabinin Avoid cleaning the mapping table(page table) of KASAN shadow area. Cc: Andrey Ryabinin Signed-off-by: Abbott Liu --- arch/arm/mm/mmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index e46a6a4..f5aa1de 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1251,9 +1251,14 @@ static inline void prepare_page_table(void) /* * Clear out all the mappings below the kernel image. */ - for (addr = 0; addr < MODULES_VADDR; addr += PMD_SIZE) + for (addr = 0; addr < TASK_SIZE; addr += PMD_SIZE) pmd_clear(pmd_off_k(addr)); +#ifdef CONFIG_KASAN + /*TASK_SIZE ~ MODULES_VADDR is the KASAN's shadow area -- skip over it*/ + addr = MODULES_VADDR; +#endif + #ifdef CONFIG_XIP_KERNEL /* The XIP kernel is mapped in the module area -- skip over it */ addr = ((unsigned long)_exiprom + PMD_SIZE - 1) & PMD_MASK; -- 2.9.0