Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161908AbbKEHHb (ORCPT ); Thu, 5 Nov 2015 02:07:31 -0500 Received: from mail-io0-f179.google.com ([209.85.223.179]:34869 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032497AbbKEHH1 (ORCPT ); Thu, 5 Nov 2015 02:07:27 -0500 MIME-Version: 1.0 In-Reply-To: <1446587315-18145-2-git-send-email-labbott@fedoraproject.org> References: <1446587315-18145-1-git-send-email-labbott@fedoraproject.org> <1446587315-18145-2-git-send-email-labbott@fedoraproject.org> Date: Thu, 5 Nov 2015 08:07:24 +0100 Message-ID: Subject: Re: [PATCH 1/2] arm64: Get existing page protections in split_pmd From: Ard Biesheuvel To: Laura Abbott Cc: Catalin Marinas , Will Deacon , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Kees Cook , Xishi Qiu , Mark Rutland Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1756 Lines: 56 Hi Laura, On 3 November 2015 at 22:48, Laura Abbott wrote: > > Rather than always putting the least restrictived permissions restrictive > (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; pgprot_t is a struct type when STRICT_MM_TYPECHECKS is in effect, so __pgprot() should cover the entire expression. With the above fixed: Reviewed-by: Ard Biesheuvel Thanks, > + > 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); > } > -- > 2.4.3 > -- 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/