From: Laura Abbott <labbott@fedoraproject.org>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Zhong Jiang <zhongjiang@huawei.com>
Cc: Laura Abbott <labbott@fedoraproject.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
Xishi Qiu <qiuxishi@huawei.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: [PATCHv2 1/2] arm64: Get existing page protections in split_pmd
Date: Tue, 10 Nov 2015 17:57:36 -0800 [thread overview]
Message-ID: <1447207057-11323-2-git-send-email-labbott@fedoraproject.org> (raw)
In-Reply-To: <1447207057-11323-1-git-send-email-labbott@fedoraproject.org>
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
next prev parent reply other threads:[~2015-11-11 1:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 1:57 [PATCHv2 0/2] Support for set_memory_* outside of module space Laura Abbott
2015-11-11 1:57 ` Laura Abbott [this message]
2015-11-15 7:32 ` [PATCHv2 1/2] arm64: Get existing page protections in split_pmd Ard Biesheuvel
2015-11-11 1:57 ` [PATCHv2 2/2] arm64: Allow changing of attributes outside of modules Laura Abbott
2015-11-12 11:55 ` zhong jiang
2015-11-12 16:31 ` Laura Abbott
2015-11-13 2:05 ` zhong jiang
2015-11-13 19:05 ` Laura Abbott
2015-11-13 2:37 ` zhong jiang
2015-11-13 8:27 ` Xishi Qiu
2015-11-13 8:32 ` Xishi Qiu
2015-11-13 19:09 ` Laura Abbott
2015-11-24 23:39 ` [PATCHv2 0/2] Support for set_memory_* outside of module space Laura Abbott
2015-11-25 12:05 ` Will Deacon
2016-01-12 0:47 ` Laura Abbott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447207057-11323-2-git-send-email-labbott@fedoraproject.org \
--to=labbott@fedoraproject.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=qiuxishi@huawei.com \
--cc=will.deacon@arm.com \
--cc=zhongjiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®