Skip to contentSkip to conversation

arm: Preserve L_PTE_VALID in pte_modify()

PATCH New Catalin Marinas 2 participants 5 messages Feb 12, 2013 – Feb 25, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: Preserve L_PTE_VALID in pte_modify()

Following commit 26ffd0d4 (ARM: mm: introduce present, faulting entries for PAGE_NONE), if a page has been mapped as PROT_NONE, the L_PTE_VALID bit is cleared by the set_pte_ext() code. With LPAE the software and hardware pte share the same location and subsequent modifications of pte range (change_protection()) will leave the L_PTE_VALID bit cleared.

This patch adds the L_PTE_VALID bit to the newprot mask in pte_modify().

---
 arch/arm/include/asm/pgtable.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/include/asm/pgtable.h +2 -1
index 9c82f988..c094749 100644
@@ -240,7 +240,8 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
 
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 {
-	const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | L_PTE_NONE;
+	const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER |
+		L_PTE_NONE | L_PTE_VALID;
 	pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
 	return pte;
 }
#1 lore raw

PATCH 1/1 arm: Preserve L_PTE_VALID in pte_modify()

Quoted 6 lines · Catalin Marinas

Following commit 26ffd0d4 (ARM: mm: introduce present, faulting entries for PAGE_NONE), if a page has been mapped as PROT_NONE, the L_PTE_VALID bit is cleared by the set_pte_ext() code. With LPAE the software and hardware pte share the same location and subsequent modifications of pte range (change_protection()) will leave the L_PTE_VALID bit cleared.

Quoted 6 lines

This patch adds the L_PTE_VALID bit to the newprot mask in pte_modify().

This matches what I did for arm64, so:

Cheers,

Will

Quoted 18 lines
---
 arch/arm/include/asm/pgtable.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/include/asm/pgtable.h +2 -1
index 9c82f988..c094749 100644
@@ -240,7 +240,8 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
 
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 {
-	const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | L_PTE_NONE;
+	const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER |
+		L_PTE_NONE | L_PTE_VALID;
 	pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
 	return pte;
 }
#2 lore raw

PATCH 1/1 arm: Preserve L_PTE_VALID in pte_modify()

Hi Catalin,

Quoted 9 lines · Will Deacon
Quoted 8 lines · Catalin Marinas

Following commit 26ffd0d4 (ARM: mm: introduce present, faulting entries for PAGE_NONE), if a page has been mapped as PROT_NONE, the L_PTE_VALID bit is cleared by the set_pte_ext() code. With LPAE the software and hardware pte share the same location and subsequent modifications of pte range (change_protection()) will leave the L_PTE_VALID bit cleared.

This patch adds the L_PTE_VALID bit to the newprot mask in pte_modify().

Quoted 8 lines
Quoted 4 lines

This matches what I did for arm64, so:

Can you put this into the patch system please?

Cheers,

Will

#3 lore raw

PATCH 1/1 arm: Preserve L_PTE_VALID in pte_modify()

Quoted 17 lines · Will Deacon

Hi Catalin,

Quoted 14 lines · Will Deacon
Quoted 12 lines · Catalin Marinas

Following commit 26ffd0d4 (ARM: mm: introduce present, faulting entries for PAGE_NONE), if a page has been mapped as PROT_NONE, the L_PTE_VALID bit is cleared by the set_pte_ext() code. With LPAE the software and hardware pte share the same location and subsequent modifications of pte range (change_protection()) will leave the L_PTE_VALID bit cleared.

This patch adds the L_PTE_VALID bit to the newprot mask in pte_modify().

Quoted 5 lines
Quoted 3 lines

This matches what I did for arm64, so:

Can you put this into the patch system please?

Already picked by rmk (I don't remember the patch number).

Signature · 1 line
Catalin
#4 lore raw

PATCH 1/1 arm: Preserve L_PTE_VALID in pte_modify()

Quoted 18 lines · Catalin Marinas
Quoted 17 lines · Will Deacon

Hi Catalin,

Quoted 14 lines · Will Deacon
Quoted 12 lines · Catalin Marinas

Following commit 26ffd0d4 (ARM: mm: introduce present, faulting entries for PAGE_NONE), if a page has been mapped as PROT_NONE, the L_PTE_VALID bit is cleared by the set_pte_ext() code. With LPAE the software and hardware pte share the same location and subsequent modifications of pte range (change_protection()) will leave the L_PTE_VALID bit cleared.

This patch adds the L_PTE_VALID bit to the newprot mask in pte_modify().

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This matches what I did for arm64, so:

Can you put this into the patch system please?

Already picked by rmk (I don't remember the patch number).

Great, sorry for the bother (I can't see the patch in any upstream trees).

Will