Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266919

[PATCHv2 1/2] arm64: Get existing page protections in split_pmd

From Laura Abbott <labbott@fedoraproject.org>
Newsgroups linux.kernel
Subject [PATCHv2 1/2] arm64: Get existing page protections in split_pmd
Date 2015-11-11 03:00 +0100
Message-ID <qtsRz-4Cy-5@gated-at.bofh.it> (permalink)
References <qtsRz-4Cy-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <labbott@fedoraproject.org>
---
v2: Typo and typechecking fixed

I chose not to add the Reviewed-by from Ard here because of the addition of
the contiguous bit in split_pmd. Not sure if I should be explicitly carrying
it over.
---
 arch/arm64/mm/mmu.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index c2fa6b5..496c3fd 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -76,15 +76,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);
+
 	int i = 0;
 
 	do {
-		/*
-		 * Need to have the least restrictive permissions available
-		 * permissions will be fixed up later. Default the new page
-		 * range as contiguous ptes.
-		 */
-		set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC_CONT));
+		set_pte(pte, pfn_pte(pfn, prot));
 		pfn++;
 	} while (pte++, i++, i < PTRS_PER_PTE);
 }
-- 
2.5.0

--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/2] Support for set_memory_* outside of module space Laura Abbott <labbott@fedoraproject.org> - 2015-11-11 03:00 +0100
  [PATCHv2 1/2] arm64: Get existing page protections in split_pmd Laura Abbott <labbott@fedoraproject.org> - 2015-11-11 03:00 +0100
    Re: [PATCHv2 1/2] arm64: Get existing page protections in split_pmd Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2015-11-15 08:40 +0100
  [PATCHv2 2/2] arm64: Allow changing of attributes outside of modules Laura Abbott <labbott@fedoraproject.org> - 2015-11-11 03:00 +0100
    Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules zhong jiang <zhongjiang@huawei.com> - 2015-11-12 13:00 +0100
      Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules Laura Abbott <labbott@redhat.com> - 2015-11-12 17:40 +0100
        Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules zhong jiang <zhongjiang@huawei.com> - 2015-11-13 03:10 +0100
          Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules Laura Abbott <labbott@redhat.com> - 2015-11-13 20:10 +0100
      Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules zhong jiang <zhongjiang@huawei.com> - 2015-11-13 03:50 +0100
    Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules Xishi Qiu <qiuxishi@huawei.com> - 2015-11-13 09:30 +0100
      Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules Xishi Qiu <qiuxishi@huawei.com> - 2015-11-13 09:40 +0100
      Re: [PATCHv2 2/2] arm64: Allow changing of attributes outside of  modules Laura Abbott <labbott@redhat.com> - 2015-11-13 20:10 +0100

csiph-web