All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot
@ 2015-11-11  2:03 ` Laura Abbott
  0 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-11  2:03 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Ard Biesheuvel
  Cc: Laura Abbott, linux-arm-kernel, linux-kernel


Several accesses of pgprot values are incorrect when compiled with
STRICT_MM_TYPECHECKS. Use the appropriate pgprot_val/__pgprot wrappers
to access the structures appropriately.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
Found while working on the set_memory_* work
---
 arch/arm64/mm/mmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index c2fa6b5..83a1162 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -146,7 +146,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
 		if (((addr | next | phys) & ~CONT_MASK) == 0) {
 			/* a block of CONT_PTES  */
 			__populate_init_pte(pte, addr, next, phys,
-					    prot | __pgprot(PTE_CONT));
+					 __pgprot(pgprot_val(prot) | PTE_CONT));
 		} else {
 			/*
 			 * If the range being split is already inside of a
@@ -475,7 +475,7 @@ void mark_rodata_ro(void)
 {
 	create_mapping_late(__pa(_stext), (unsigned long)_stext,
 				(unsigned long)_etext - (unsigned long)_stext,
-				PAGE_KERNEL_EXEC | PTE_RDONLY);
+				__pgprot(pgprot_val(PAGE_KERNEL_EXEC) | PTE_RDONLY));
 
 }
 #endif
@@ -691,7 +691,7 @@ void __set_fixmap(enum fixed_addresses idx,
 void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
 {
 	const u64 dt_virt_base = __fix_to_virt(FIX_FDT);
-	pgprot_t prot = PAGE_KERNEL | PTE_RDONLY;
+	pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | PTE_RDONLY);
 	int size, offset;
 	void *dt_virt;
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot
@ 2015-11-11  2:03 ` Laura Abbott
  0 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-11  2:03 UTC (permalink / raw)
  To: linux-arm-kernel


Several accesses of pgprot values are incorrect when compiled with
STRICT_MM_TYPECHECKS. Use the appropriate pgprot_val/__pgprot wrappers
to access the structures appropriately.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
Found while working on the set_memory_* work
---
 arch/arm64/mm/mmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index c2fa6b5..83a1162 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -146,7 +146,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
 		if (((addr | next | phys) & ~CONT_MASK) == 0) {
 			/* a block of CONT_PTES  */
 			__populate_init_pte(pte, addr, next, phys,
-					    prot | __pgprot(PTE_CONT));
+					 __pgprot(pgprot_val(prot) | PTE_CONT));
 		} else {
 			/*
 			 * If the range being split is already inside of a
@@ -475,7 +475,7 @@ void mark_rodata_ro(void)
 {
 	create_mapping_late(__pa(_stext), (unsigned long)_stext,
 				(unsigned long)_etext - (unsigned long)_stext,
-				PAGE_KERNEL_EXEC | PTE_RDONLY);
+				__pgprot(pgprot_val(PAGE_KERNEL_EXEC) | PTE_RDONLY));
 
 }
 #endif
@@ -691,7 +691,7 @@ void __set_fixmap(enum fixed_addresses idx,
 void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
 {
 	const u64 dt_virt_base = __fix_to_virt(FIX_FDT);
-	pgprot_t prot = PAGE_KERNEL | PTE_RDONLY;
+	pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | PTE_RDONLY);
 	int size, offset;
 	void *dt_virt;
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/2] arm: kvm: Fix STRICT_MM_TYPECHECK errors
  2015-11-11  2:03 ` Laura Abbott
@ 2015-11-11  2:03   ` Laura Abbott
  -1 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-11  2:03 UTC (permalink / raw)
  To: Christoffer Dall, Marc Zyngier
  Cc: Laura Abbott, Russell King, linux-arm-kernel, kvmarm, kvm, linux-kernel


PAGE_S2_DEVICE is a pgprot val and needs to be accessed using the proper
accessors. Switch to these accessors to avoid errors with
STRICT_MM_TYPECHECK.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
Found in the course of other work
---
 arch/arm/kvm/mmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 6984342..43f8162 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -213,7 +213,8 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
 			kvm_tlb_flush_vmid_ipa(kvm, addr);
 
 			/* No need to invalidate the cache for device mappings */
-			if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
+			if ((pte_val(old_pte) & pgprot_val(PAGE_S2_DEVICE)) !=
+			     pgprot_val(PAGE_S2_DEVICE))
 				kvm_flush_dcache_pte(old_pte);
 
 			put_page(virt_to_page(pte));
@@ -306,7 +307,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
 	pte = pte_offset_kernel(pmd, addr);
 	do {
 		if (!pte_none(*pte) &&
-		    (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
+		    (pte_val(*pte) & pgprot_val(PAGE_S2_DEVICE)) !=
+		     pgprot_val(PAGE_S2_DEVICE))
 			kvm_flush_dcache_pte(*pte);
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 }
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/2] arm: kvm: Fix STRICT_MM_TYPECHECK errors
@ 2015-11-11  2:03   ` Laura Abbott
  0 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-11  2:03 UTC (permalink / raw)
  To: linux-arm-kernel


PAGE_S2_DEVICE is a pgprot val and needs to be accessed using the proper
accessors. Switch to these accessors to avoid errors with
STRICT_MM_TYPECHECK.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
Found in the course of other work
---
 arch/arm/kvm/mmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 6984342..43f8162 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -213,7 +213,8 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
 			kvm_tlb_flush_vmid_ipa(kvm, addr);
 
 			/* No need to invalidate the cache for device mappings */
-			if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
+			if ((pte_val(old_pte) & pgprot_val(PAGE_S2_DEVICE)) !=
+			     pgprot_val(PAGE_S2_DEVICE))
 				kvm_flush_dcache_pte(old_pte);
 
 			put_page(virt_to_page(pte));
@@ -306,7 +307,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
 	pte = pte_offset_kernel(pmd, addr);
 	do {
 		if (!pte_none(*pte) &&
-		    (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
+		    (pte_val(*pte) & pgprot_val(PAGE_S2_DEVICE)) !=
+		     pgprot_val(PAGE_S2_DEVICE))
 			kvm_flush_dcache_pte(*pte);
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot
  2015-11-11  2:03 ` Laura Abbott
@ 2015-11-11  5:51   ` Ard Biesheuvel
  -1 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-11  5:51 UTC (permalink / raw)
  To: Laura Abbott; +Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel

Hi Laura,

On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>
> Several accesses of pgprot values are incorrect when compiled with
> STRICT_MM_TYPECHECKS. Use the appropriate pgprot_val/__pgprot wrappers
> to access the structures appropriately.
>

I spotted 2 out of these, and Catalin has already queued fixes for
them (see below)

> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
> Found while working on the set_memory_* work
> ---
>  arch/arm64/mm/mmu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index c2fa6b5..83a1162 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -146,7 +146,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
>                 if (((addr | next | phys) & ~CONT_MASK) == 0) {
>                         /* a block of CONT_PTES  */
>                         __populate_init_pte(pte, addr, next, phys,
> -                                           prot | __pgprot(PTE_CONT));
> +                                        __pgprot(pgprot_val(prot) | PTE_CONT));

Got this one

>                 } else {
>                         /*
>                          * If the range being split is already inside of a
> @@ -475,7 +475,7 @@ void mark_rodata_ro(void)
>  {
>         create_mapping_late(__pa(_stext), (unsigned long)_stext,
>                                 (unsigned long)_etext - (unsigned long)_stext,
> -                               PAGE_KERNEL_EXEC | PTE_RDONLY);
> +                               __pgprot(pgprot_val(PAGE_KERNEL_EXEC) | PTE_RDONLY));
>

This needs PAGE_KERNEL_RO (which was just introduced). The reason is
that PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
writeable under the ARMv8.1 DBM feature, that manages the dirty bit in
hardware (writing to a page with the PTE_RDONLY and PTE_WRITE bits
both set will clear the PTE_RDONLY bit in that case)

>  }
>  #endif
> @@ -691,7 +691,7 @@ void __set_fixmap(enum fixed_addresses idx,
>  void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
>  {
>         const u64 dt_virt_base = __fix_to_virt(FIX_FDT);
> -       pgprot_t prot = PAGE_KERNEL | PTE_RDONLY;
> +       pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | PTE_RDONLY);

Got this one as well (using PAGE_KERNEL_RO)

>         int size, offset;
>         void *dt_virt;
>
> --
> 2.5.0
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot
@ 2015-11-11  5:51   ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-11  5:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Laura,

On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>
> Several accesses of pgprot values are incorrect when compiled with
> STRICT_MM_TYPECHECKS. Use the appropriate pgprot_val/__pgprot wrappers
> to access the structures appropriately.
>

I spotted 2 out of these, and Catalin has already queued fixes for
them (see below)

> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
> Found while working on the set_memory_* work
> ---
>  arch/arm64/mm/mmu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index c2fa6b5..83a1162 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -146,7 +146,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
>                 if (((addr | next | phys) & ~CONT_MASK) == 0) {
>                         /* a block of CONT_PTES  */
>                         __populate_init_pte(pte, addr, next, phys,
> -                                           prot | __pgprot(PTE_CONT));
> +                                        __pgprot(pgprot_val(prot) | PTE_CONT));

Got this one

>                 } else {
>                         /*
>                          * If the range being split is already inside of a
> @@ -475,7 +475,7 @@ void mark_rodata_ro(void)
>  {
>         create_mapping_late(__pa(_stext), (unsigned long)_stext,
>                                 (unsigned long)_etext - (unsigned long)_stext,
> -                               PAGE_KERNEL_EXEC | PTE_RDONLY);
> +                               __pgprot(pgprot_val(PAGE_KERNEL_EXEC) | PTE_RDONLY));
>

This needs PAGE_KERNEL_RO (which was just introduced). The reason is
that PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
writeable under the ARMv8.1 DBM feature, that manages the dirty bit in
hardware (writing to a page with the PTE_RDONLY and PTE_WRITE bits
both set will clear the PTE_RDONLY bit in that case)

>  }
>  #endif
> @@ -691,7 +691,7 @@ void __set_fixmap(enum fixed_addresses idx,
>  void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
>  {
>         const u64 dt_virt_base = __fix_to_virt(FIX_FDT);
> -       pgprot_t prot = PAGE_KERNEL | PTE_RDONLY;
> +       pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | PTE_RDONLY);

Got this one as well (using PAGE_KERNEL_RO)

>         int size, offset;
>         void *dt_virt;
>
> --
> 2.5.0
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot
  2015-11-11  5:51   ` Ard Biesheuvel
@ 2015-11-11  6:02     ` Ard Biesheuvel
  -1 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-11  6:02 UTC (permalink / raw)
  To: Laura Abbott; +Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel

On 11 November 2015 at 06:51, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> Hi Laura,
>
> On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>>
>> Several accesses of pgprot values are incorrect when compiled with
>> STRICT_MM_TYPECHECKS. Use the appropriate pgprot_val/__pgprot wrappers
>> to access the structures appropriately.
>>
>
> I spotted 2 out of these, and Catalin has already queued fixes for
> them (see below)
>
>> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
>> ---
>> Found while working on the set_memory_* work
>> ---
>>  arch/arm64/mm/mmu.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
>> index c2fa6b5..83a1162 100644
>> --- a/arch/arm64/mm/mmu.c
>> +++ b/arch/arm64/mm/mmu.c
>> @@ -146,7 +146,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
>>                 if (((addr | next | phys) & ~CONT_MASK) == 0) {
>>                         /* a block of CONT_PTES  */
>>                         __populate_init_pte(pte, addr, next, phys,
>> -                                           prot | __pgprot(PTE_CONT));
>> +                                        __pgprot(pgprot_val(prot) | PTE_CONT));
>
> Got this one
>
>>                 } else {
>>                         /*
>>                          * If the range being split is already inside of a
>> @@ -475,7 +475,7 @@ void mark_rodata_ro(void)
>>  {
>>         create_mapping_late(__pa(_stext), (unsigned long)_stext,
>>                                 (unsigned long)_etext - (unsigned long)_stext,
>> -                               PAGE_KERNEL_EXEC | PTE_RDONLY);
>> +                               __pgprot(pgprot_val(PAGE_KERNEL_EXEC) | PTE_RDONLY));
>>
>
> This needs PAGE_KERNEL_RO (which was just introduced). The reason is
> that PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
> writeable under the ARMv8.1 DBM feature, that manages the dirty bit in
> hardware (writing to a page with the PTE_RDONLY and PTE_WRITE bits
> both set will clear the PTE_RDONLY bit in that case)
>

...only you'd obviously need to clear the PTE_PXN bit (or introduce a
new PAGE_KERNEL_xx define?)

>>  }
>>  #endif
>> @@ -691,7 +691,7 @@ void __set_fixmap(enum fixed_addresses idx,
>>  void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
>>  {
>>         const u64 dt_virt_base = __fix_to_virt(FIX_FDT);
>> -       pgprot_t prot = PAGE_KERNEL | PTE_RDONLY;
>> +       pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | PTE_RDONLY);
>
> Got this one as well (using PAGE_KERNEL_RO)
>
>>         int size, offset;
>>         void *dt_virt;
>>
>> --
>> 2.5.0
>>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot
@ 2015-11-11  6:02     ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-11  6:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 11 November 2015 at 06:51, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> Hi Laura,
>
> On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>>
>> Several accesses of pgprot values are incorrect when compiled with
>> STRICT_MM_TYPECHECKS. Use the appropriate pgprot_val/__pgprot wrappers
>> to access the structures appropriately.
>>
>
> I spotted 2 out of these, and Catalin has already queued fixes for
> them (see below)
>
>> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
>> ---
>> Found while working on the set_memory_* work
>> ---
>>  arch/arm64/mm/mmu.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
>> index c2fa6b5..83a1162 100644
>> --- a/arch/arm64/mm/mmu.c
>> +++ b/arch/arm64/mm/mmu.c
>> @@ -146,7 +146,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
>>                 if (((addr | next | phys) & ~CONT_MASK) == 0) {
>>                         /* a block of CONT_PTES  */
>>                         __populate_init_pte(pte, addr, next, phys,
>> -                                           prot | __pgprot(PTE_CONT));
>> +                                        __pgprot(pgprot_val(prot) | PTE_CONT));
>
> Got this one
>
>>                 } else {
>>                         /*
>>                          * If the range being split is already inside of a
>> @@ -475,7 +475,7 @@ void mark_rodata_ro(void)
>>  {
>>         create_mapping_late(__pa(_stext), (unsigned long)_stext,
>>                                 (unsigned long)_etext - (unsigned long)_stext,
>> -                               PAGE_KERNEL_EXEC | PTE_RDONLY);
>> +                               __pgprot(pgprot_val(PAGE_KERNEL_EXEC) | PTE_RDONLY));
>>
>
> This needs PAGE_KERNEL_RO (which was just introduced). The reason is
> that PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
> writeable under the ARMv8.1 DBM feature, that manages the dirty bit in
> hardware (writing to a page with the PTE_RDONLY and PTE_WRITE bits
> both set will clear the PTE_RDONLY bit in that case)
>

...only you'd obviously need to clear the PTE_PXN bit (or introduce a
new PAGE_KERNEL_xx define?)

>>  }
>>  #endif
>> @@ -691,7 +691,7 @@ void __set_fixmap(enum fixed_addresses idx,
>>  void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
>>  {
>>         const u64 dt_virt_base = __fix_to_virt(FIX_FDT);
>> -       pgprot_t prot = PAGE_KERNEL | PTE_RDONLY;
>> +       pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | PTE_RDONLY);
>
> Got this one as well (using PAGE_KERNEL_RO)
>
>>         int size, offset;
>>         void *dt_virt;
>>
>> --
>> 2.5.0
>>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
  2015-11-11  6:02     ` Ard Biesheuvel
@ 2015-11-12 20:21       ` Laura Abbott
  -1 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-12 20:21 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Ard Biesheuvel
  Cc: Laura Abbott, linux-arm-kernel, linux-kernel

The permissions in mark_rodata_ro trigger a build error
with STRICT_MM_TYPECHECKS. Fix this by introducing
PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
>From Ard:

"PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
writeable under the ARMv8.1 DBM feature, that manages the
dirty bit in hardware (writing to a page with the PTE_RDONLY
and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
 arch/arm64/include/asm/pgtable.h | 1 +
 arch/arm64/mm/mmu.c              | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 9819a94..7e074f9 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -81,6 +81,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
 
 #define PAGE_KERNEL		__pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
 #define PAGE_KERNEL_RO		__pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
+#define PAGE_KERNEL_ROX	__pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
 #define PAGE_KERNEL_EXEC	__pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)
 #define PAGE_KERNEL_EXEC_CONT	__pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)
 
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 9ca5996..6598c48 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -475,7 +475,7 @@ void mark_rodata_ro(void)
 {
 	create_mapping_late(__pa(_stext), (unsigned long)_stext,
 				(unsigned long)_etext - (unsigned long)_stext,
-				PAGE_KERNEL_EXEC | PTE_RDONLY);
+				PAGE_KERNEL_ROX);
 
 }
 #endif
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
@ 2015-11-12 20:21       ` Laura Abbott
  0 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-12 20:21 UTC (permalink / raw)
  To: linux-arm-kernel

The permissions in mark_rodata_ro trigger a build error
with STRICT_MM_TYPECHECKS. Fix this by introducing
PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
>From Ard:

"PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
writeable under the ARMv8.1 DBM feature, that manages the
dirty bit in hardware (writing to a page with the PTE_RDONLY
and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
 arch/arm64/include/asm/pgtable.h | 1 +
 arch/arm64/mm/mmu.c              | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 9819a94..7e074f9 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -81,6 +81,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
 
 #define PAGE_KERNEL		__pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
 #define PAGE_KERNEL_RO		__pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
+#define PAGE_KERNEL_ROX	__pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
 #define PAGE_KERNEL_EXEC	__pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)
 #define PAGE_KERNEL_EXEC_CONT	__pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)
 
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 9ca5996..6598c48 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -475,7 +475,7 @@ void mark_rodata_ro(void)
 {
 	create_mapping_late(__pa(_stext), (unsigned long)_stext,
 				(unsigned long)_etext - (unsigned long)_stext,
-				PAGE_KERNEL_EXEC | PTE_RDONLY);
+				PAGE_KERNEL_ROX);
 
 }
 #endif
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/2] arm: kvm: Fix STRICT_MM_TYPECHECK errors
  2015-11-11  2:03   ` Laura Abbott
  (?)
@ 2015-11-14  7:02     ` Ard Biesheuvel
  -1 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-14  7:02 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Christoffer Dall, Marc Zyngier, Russell King,
	KVM devel mailing list, linux-kernel, kvmarm, linux-arm-kernel

On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>
> PAGE_S2_DEVICE is a pgprot val and needs to be accessed using the proper
> accessors. Switch to these accessors to avoid errors with
> STRICT_MM_TYPECHECK.
>
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
> Found in the course of other work

Already fixed here:
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/142953

Looks like we may need a mutex :-)

> ---
>  arch/arm/kvm/mmu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 6984342..43f8162 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -213,7 +213,8 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
>                         kvm_tlb_flush_vmid_ipa(kvm, addr);
>
>                         /* No need to invalidate the cache for device mappings */
> -                       if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
> +                       if ((pte_val(old_pte) & pgprot_val(PAGE_S2_DEVICE)) !=
> +                            pgprot_val(PAGE_S2_DEVICE))
>                                 kvm_flush_dcache_pte(old_pte);
>
>                         put_page(virt_to_page(pte));
> @@ -306,7 +307,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
>         pte = pte_offset_kernel(pmd, addr);
>         do {
>                 if (!pte_none(*pte) &&
> -                   (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
> +                   (pte_val(*pte) & pgprot_val(PAGE_S2_DEVICE)) !=
> +                    pgprot_val(PAGE_S2_DEVICE))
>                         kvm_flush_dcache_pte(*pte);
>         } while (pte++, addr += PAGE_SIZE, addr != end);
>  }
> --
> 2.5.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/2] arm: kvm: Fix STRICT_MM_TYPECHECK errors
@ 2015-11-14  7:02     ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-14  7:02 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Russell King, KVM devel mailing list, Marc Zyngier, linux-kernel,
	linux-arm-kernel, kvmarm

On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>
> PAGE_S2_DEVICE is a pgprot val and needs to be accessed using the proper
> accessors. Switch to these accessors to avoid errors with
> STRICT_MM_TYPECHECK.
>
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
> Found in the course of other work

Already fixed here:
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/142953

Looks like we may need a mutex :-)

> ---
>  arch/arm/kvm/mmu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 6984342..43f8162 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -213,7 +213,8 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
>                         kvm_tlb_flush_vmid_ipa(kvm, addr);
>
>                         /* No need to invalidate the cache for device mappings */
> -                       if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
> +                       if ((pte_val(old_pte) & pgprot_val(PAGE_S2_DEVICE)) !=
> +                            pgprot_val(PAGE_S2_DEVICE))
>                                 kvm_flush_dcache_pte(old_pte);
>
>                         put_page(virt_to_page(pte));
> @@ -306,7 +307,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
>         pte = pte_offset_kernel(pmd, addr);
>         do {
>                 if (!pte_none(*pte) &&
> -                   (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
> +                   (pte_val(*pte) & pgprot_val(PAGE_S2_DEVICE)) !=
> +                    pgprot_val(PAGE_S2_DEVICE))
>                         kvm_flush_dcache_pte(*pte);
>         } while (pte++, addr += PAGE_SIZE, addr != end);
>  }
> --
> 2.5.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] arm: kvm: Fix STRICT_MM_TYPECHECK errors
@ 2015-11-14  7:02     ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-14  7:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 11 November 2015 at 03:03, Laura Abbott <labbott@fedoraproject.org> wrote:
>
> PAGE_S2_DEVICE is a pgprot val and needs to be accessed using the proper
> accessors. Switch to these accessors to avoid errors with
> STRICT_MM_TYPECHECK.
>
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
> Found in the course of other work

Already fixed here:
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/142953

Looks like we may need a mutex :-)

> ---
>  arch/arm/kvm/mmu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 6984342..43f8162 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -213,7 +213,8 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
>                         kvm_tlb_flush_vmid_ipa(kvm, addr);
>
>                         /* No need to invalidate the cache for device mappings */
> -                       if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
> +                       if ((pte_val(old_pte) & pgprot_val(PAGE_S2_DEVICE)) !=
> +                            pgprot_val(PAGE_S2_DEVICE))
>                                 kvm_flush_dcache_pte(old_pte);
>
>                         put_page(virt_to_page(pte));
> @@ -306,7 +307,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
>         pte = pte_offset_kernel(pmd, addr);
>         do {
>                 if (!pte_none(*pte) &&
> -                   (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
> +                   (pte_val(*pte) & pgprot_val(PAGE_S2_DEVICE)) !=
> +                    pgprot_val(PAGE_S2_DEVICE))
>                         kvm_flush_dcache_pte(*pte);
>         } while (pte++, addr += PAGE_SIZE, addr != end);
>  }
> --
> 2.5.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
  2015-11-12 20:21       ` Laura Abbott
@ 2015-11-15  7:38         ` Ard Biesheuvel
  -1 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-15  7:38 UTC (permalink / raw)
  To: Laura Abbott; +Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel

On 12 November 2015 at 21:21, Laura Abbott <labbott@fedoraproject.org> wrote:
> The permissions in mark_rodata_ro trigger a build error
> with STRICT_MM_TYPECHECKS. Fix this by introducing
> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.

Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more consistent?

> From Ard:
>
> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
> writeable under the ARMv8.1 DBM feature, that manages the
> dirty bit in hardware (writing to a page with the PTE_RDONLY
> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
>
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  arch/arm64/include/asm/pgtable.h | 1 +
>  arch/arm64/mm/mmu.c              | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 9819a94..7e074f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -81,6 +81,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
>
>  #define PAGE_KERNEL            __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
>  #define PAGE_KERNEL_RO         __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
> +#define PAGE_KERNEL_ROX        __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
>  #define PAGE_KERNEL_EXEC       __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)
>  #define PAGE_KERNEL_EXEC_CONT  __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 9ca5996..6598c48 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -475,7 +475,7 @@ void mark_rodata_ro(void)
>  {
>         create_mapping_late(__pa(_stext), (unsigned long)_stext,
>                                 (unsigned long)_etext - (unsigned long)_stext,
> -                               PAGE_KERNEL_EXEC | PTE_RDONLY);
> +                               PAGE_KERNEL_ROX);
>
>  }
>  #endif
> --
> 2.5.0
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
@ 2015-11-15  7:38         ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-15  7:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 12 November 2015 at 21:21, Laura Abbott <labbott@fedoraproject.org> wrote:
> The permissions in mark_rodata_ro trigger a build error
> with STRICT_MM_TYPECHECKS. Fix this by introducing
> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.

Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more consistent?

> From Ard:
>
> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
> writeable under the ARMv8.1 DBM feature, that manages the
> dirty bit in hardware (writing to a page with the PTE_RDONLY
> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
>
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  arch/arm64/include/asm/pgtable.h | 1 +
>  arch/arm64/mm/mmu.c              | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 9819a94..7e074f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -81,6 +81,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
>
>  #define PAGE_KERNEL            __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
>  #define PAGE_KERNEL_RO         __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
> +#define PAGE_KERNEL_ROX        __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
>  #define PAGE_KERNEL_EXEC       __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)
>  #define PAGE_KERNEL_EXEC_CONT  __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 9ca5996..6598c48 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -475,7 +475,7 @@ void mark_rodata_ro(void)
>  {
>         create_mapping_late(__pa(_stext), (unsigned long)_stext,
>                                 (unsigned long)_etext - (unsigned long)_stext,
> -                               PAGE_KERNEL_EXEC | PTE_RDONLY);
> +                               PAGE_KERNEL_ROX);
>
>  }
>  #endif
> --
> 2.5.0
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
  2015-11-15  7:38         ` Ard Biesheuvel
@ 2015-11-16 22:50           ` Laura Abbott
  -1 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-16 22:50 UTC (permalink / raw)
  To: Ard Biesheuvel, Laura Abbott
  Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel

On 11/14/2015 11:38 PM, Ard Biesheuvel wrote:
> On 12 November 2015 at 21:21, Laura Abbott <labbott@fedoraproject.org> wrote:
>> The permissions in mark_rodata_ro trigger a build error
>> with STRICT_MM_TYPECHECKS. Fix this by introducing
>> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
>
> Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more consistent?
>

powerpc was using PAGE_KERNEL_ROX so I went with that. Blame powerpc ;)
  
>>  From Ard:
>>
>> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
>> writeable under the ARMv8.1 DBM feature, that manages the
>> dirty bit in hardware (writing to a page with the PTE_RDONLY
>> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
>>
>> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
>
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>

Thanks,
Laura


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
@ 2015-11-16 22:50           ` Laura Abbott
  0 siblings, 0 replies; 21+ messages in thread
From: Laura Abbott @ 2015-11-16 22:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/14/2015 11:38 PM, Ard Biesheuvel wrote:
> On 12 November 2015 at 21:21, Laura Abbott <labbott@fedoraproject.org> wrote:
>> The permissions in mark_rodata_ro trigger a build error
>> with STRICT_MM_TYPECHECKS. Fix this by introducing
>> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
>
> Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more consistent?
>

powerpc was using PAGE_KERNEL_ROX so I went with that. Blame powerpc ;)
  
>>  From Ard:
>>
>> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
>> writeable under the ARMv8.1 DBM feature, that manages the
>> dirty bit in hardware (writing to a page with the PTE_RDONLY
>> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
>>
>> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
>
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>

Thanks,
Laura

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
  2015-11-16 22:50           ` Laura Abbott
@ 2015-11-17  9:56             ` Ard Biesheuvel
  -1 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-17  9:56 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Laura Abbott, Catalin Marinas, Will Deacon, linux-arm-kernel,
	linux-kernel

On 16 November 2015 at 23:50, Laura Abbott <labbott@redhat.com> wrote:
> On 11/14/2015 11:38 PM, Ard Biesheuvel wrote:
>>
>> On 12 November 2015 at 21:21, Laura Abbott <labbott@fedoraproject.org>
>> wrote:
>>>
>>> The permissions in mark_rodata_ro trigger a build error
>>> with STRICT_MM_TYPECHECKS. Fix this by introducing
>>> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
>>
>>
>> Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more
>> consistent?
>>
>
> powerpc was using PAGE_KERNEL_ROX so I went with that. Blame powerpc ;)
>

OK, in that case, let's keep PAGE_KERNEL_ROX

>>>
>>>  From Ard:
>>>
>>> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
>>> writeable under the ARMv8.1 DBM feature, that manages the
>>> dirty bit in hardware (writing to a page with the PTE_RDONLY
>>> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
>>>
>>> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
>>
>>
>> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>
>
> Thanks,
> Laura
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
@ 2015-11-17  9:56             ` Ard Biesheuvel
  0 siblings, 0 replies; 21+ messages in thread
From: Ard Biesheuvel @ 2015-11-17  9:56 UTC (permalink / raw)
  To: linux-arm-kernel

On 16 November 2015 at 23:50, Laura Abbott <labbott@redhat.com> wrote:
> On 11/14/2015 11:38 PM, Ard Biesheuvel wrote:
>>
>> On 12 November 2015 at 21:21, Laura Abbott <labbott@fedoraproject.org>
>> wrote:
>>>
>>> The permissions in mark_rodata_ro trigger a build error
>>> with STRICT_MM_TYPECHECKS. Fix this by introducing
>>> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
>>
>>
>> Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more
>> consistent?
>>
>
> powerpc was using PAGE_KERNEL_ROX so I went with that. Blame powerpc ;)
>

OK, in that case, let's keep PAGE_KERNEL_ROX

>>>
>>>  From Ard:
>>>
>>> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
>>> writeable under the ARMv8.1 DBM feature, that manages the
>>> dirty bit in hardware (writing to a page with the PTE_RDONLY
>>> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
>>>
>>> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
>>
>>
>> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>
>
> Thanks,
> Laura
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
  2015-11-12 20:21       ` Laura Abbott
@ 2015-11-18 12:14         ` Catalin Marinas
  -1 siblings, 0 replies; 21+ messages in thread
From: Catalin Marinas @ 2015-11-18 12:14 UTC (permalink / raw)
  To: Laura Abbott; +Cc: Will Deacon, Ard Biesheuvel, linux-kernel, linux-arm-kernel

On Thu, Nov 12, 2015 at 12:21:10PM -0800, Laura Abbott wrote:
> The permissions in mark_rodata_ro trigger a build error
> with STRICT_MM_TYPECHECKS. Fix this by introducing
> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
> From Ard:
> 
> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
> writeable under the ARMv8.1 DBM feature, that manages the
> dirty bit in hardware (writing to a page with the PTE_RDONLY
> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
> 
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>

Applied. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro
@ 2015-11-18 12:14         ` Catalin Marinas
  0 siblings, 0 replies; 21+ messages in thread
From: Catalin Marinas @ 2015-11-18 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 12, 2015 at 12:21:10PM -0800, Laura Abbott wrote:
> The permissions in mark_rodata_ro trigger a build error
> with STRICT_MM_TYPECHECKS. Fix this by introducing
> PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO.
> From Ard:
> 
> "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range
> writeable under the ARMv8.1 DBM feature, that manages the
> dirty bit in hardware (writing to a page with the PTE_RDONLY
> and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)"
> 
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>

Applied. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-11-18 12:14 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11  2:03 [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot Laura Abbott
2015-11-11  2:03 ` Laura Abbott
2015-11-11  2:03 ` [PATCH 2/2] arm: kvm: Fix STRICT_MM_TYPECHECK errors Laura Abbott
2015-11-11  2:03   ` Laura Abbott
2015-11-14  7:02   ` Ard Biesheuvel
2015-11-14  7:02     ` Ard Biesheuvel
2015-11-14  7:02     ` Ard Biesheuvel
2015-11-11  5:51 ` [PATCH 1/2] arm64: Fix STRICT_MM_TYPECHECKS errors from pgprot Ard Biesheuvel
2015-11-11  5:51   ` Ard Biesheuvel
2015-11-11  6:02   ` Ard Biesheuvel
2015-11-11  6:02     ` Ard Biesheuvel
2015-11-12 20:21     ` [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro Laura Abbott
2015-11-12 20:21       ` Laura Abbott
2015-11-15  7:38       ` Ard Biesheuvel
2015-11-15  7:38         ` Ard Biesheuvel
2015-11-16 22:50         ` Laura Abbott
2015-11-16 22:50           ` Laura Abbott
2015-11-17  9:56           ` Ard Biesheuvel
2015-11-17  9:56             ` Ard Biesheuvel
2015-11-18 12:14       ` Catalin Marinas
2015-11-18 12:14         ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.