Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261918 > unrolled thread
| Started by | Laura Abbott <labbott@fedoraproject.org> |
|---|---|
| First post | 2015-11-03 22:50 +0100 |
| Last post | 2015-11-06 02:30 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/2] arm64: Get existing page protections in split_pmd Laura Abbott <labbott@fedoraproject.org> - 2015-11-03 22:50 +0100
Re: [PATCH 1/2] arm64: Get existing page protections in split_pmd Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2015-11-05 08:10 +0100
Re: [PATCH 1/2] arm64: Get existing page protections in split_pmd Xishi Qiu <qiuxishi@huawei.com> - 2015-11-05 11:20 +0100
Re: [PATCH 1/2] arm64: Get existing page protections in split_pmd Laura Abbott <labbott@redhat.com> - 2015-11-06 02:30 +0100
| From | Laura Abbott <labbott@fedoraproject.org> |
|---|---|
| Date | 2015-11-03 22:50 +0100 |
| Subject | [PATCH 1/2] arm64: Get existing page protections in split_pmd |
| Message-ID | <qqRCO-8it-13@gated-at.bofh.it> |
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>
---
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;
+
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/
[toc] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2015-11-05 08:10 +0100 |
| Message-ID | <qrmQh-3q6-5@gated-at.bofh.it> |
| In reply to | #1261918 |
Hi Laura,
On 3 November 2015 at 22:48, Laura Abbott <labbott@fedoraproject.org> 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 <labbott@fedoraproject.org>
> ---
> 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 <ard.biesheuvel@linaro.org>
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/
[toc] | [prev] | [next] | [standalone]
| From | Xishi Qiu <qiuxishi@huawei.com> |
|---|---|
| Date | 2015-11-05 11:20 +0100 |
| Message-ID | <qrpOa-5g9-7@gated-at.bofh.it> |
| In reply to | #1261918 |
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 <labbott@fedoraproject.org>
> ---
> 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/
[toc] | [prev] | [next] | [standalone]
| From | Laura Abbott <labbott@redhat.com> |
|---|---|
| Date | 2015-11-06 02:30 +0100 |
| Message-ID | <qrE0O-6eC-1@gated-at.bofh.it> |
| In reply to | #1263065 |
On 11/05/2015 02:15 AM, Xishi Qiu wrote:
> 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 <labbott@fedoraproject.org>
>> ---
>> 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?
I'm assuming by large page you mean a block mapping. Yes, without
that entry the kernel treats this as a block mapping
> And what is the different from the flag xx_TYPE_SECT?
That would mark it this as a block mapping which is not what we want
here.
>
> Thanks,
> Xishi Qiu
>
--
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web