Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031558AbbKEKSh (ORCPT ); Thu, 5 Nov 2015 05:18:37 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:40076 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031067AbbKEKSg (ORCPT ); Thu, 5 Nov 2015 05:18:36 -0500 Message-ID: <563B2C32.10307@huawei.com> Date: Thu, 5 Nov 2015 18:15:14 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Laura Abbott CC: Catalin Marinas , Will Deacon , , , Kees Cook , "Ard Biesheuvel" , Mark Rutland Subject: Re: [PATCH 1/2] arm64: Get existing page protections in split_pmd References: <1446587315-18145-1-git-send-email-labbott@fedoraproject.org> <1446587315-18145-2-git-send-email-labbott@fedoraproject.org> In-Reply-To: <1446587315-18145-2-git-send-email-labbott@fedoraproject.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.563B2C4D.007E,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: 63b0bee96048589e08824ecaab468e04 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1590 Lines: 55 On 2015/11/4 5:48, Laura Abbott wrote: > > Rather than always putting the least restrictived permissions > (PAGE_KERNEL_EXEC) when spliting a pmd into pages, use > the existing permissions from the pmd for the page. > > Signed-off-by: Laura Abbott > --- > arch/arm64/mm/mmu.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 9211b85..ff41efa 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -75,14 +75,13 @@ static void __init *early_alloc(unsigned long sz) > static void split_pmd(pmd_t *pmd, pte_t *pte) > { > unsigned long pfn = pmd_pfn(*pmd); > + unsigned long addr = pfn << PAGE_SHIFT; > + pgprot_t prot = __pgprot(pmd_val(*pmd) ^ addr) | PTE_TYPE_PAGE; > + Hi Laura, I'm not quite understand, I find split_pud() doesn't set the flag PMD_TYPE_TABLE. If we clear xx_TABLE_BIT, does that means the page is large page? And what is the different from the flag xx_TYPE_SECT? Thanks, Xishi Qiu > int i = 0; > > do { > - /* > - * Need to have the least restrictive permissions available > - * permissions will be fixed up later > - */ > - set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC)); > + set_pte(pte, pfn_pte(pfn, prot)); > pfn++; > } while (pte++, i++, i < PTRS_PER_PTE); > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/