linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: Couple kernel and user write page perm bits for CONFIG_X2TLB
@ 2009-12-13 11:18 Matt Fleming
  2009-12-14  6:20 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Fleming @ 2009-12-13 11:18 UTC (permalink / raw)
  To: linux-sh

pte_write() should check whether the permissions include either the user
or kernel write permission bits. Likewise, pte_wrprotect() needs to
remove both the kernel and user write bits.

Without this patch handle_tlbmiss() doesn't handle faulting in pages
from the P3 area (our vmalloc space) because of a write. Mappings of the
P3 space have the _PAGE_EXT_KERN_WRITE bit but not _PAGE_EXT_USER_WRITE.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
---
 arch/sh/include/asm/pgtable_32.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
index b354355..5003ee8 100644
--- a/arch/sh/include/asm/pgtable_32.h
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -344,7 +344,8 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
 #define pte_special(pte)	((pte).pte_low & _PAGE_SPECIAL)
 
 #ifdef CONFIG_X2TLB
-#define pte_write(pte)		((pte).pte_high & _PAGE_EXT_USER_WRITE)
+#define pte_write(pte) \
+	((pte).pte_high & (_PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE))
 #else
 #define pte_write(pte)		((pte).pte_low & _PAGE_RW)
 #endif
@@ -358,7 +359,7 @@ static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
  * individually toggled (and user permissions are entirely decoupled from
  * kernel permissions), we attempt to couple them a bit more sanely here.
  */
-PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
+PTE_BIT_FUNC(high, wrprotect, &= ~(_PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE));
 PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
 PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
 #else
-- 
1.6.2.5


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

* Re: [PATCH] sh: Couple kernel and user write page perm bits for CONFIG_X2TLB
  2009-12-13 11:18 [PATCH] sh: Couple kernel and user write page perm bits for CONFIG_X2TLB Matt Fleming
@ 2009-12-14  6:20 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2009-12-14  6:20 UTC (permalink / raw)
  To: linux-sh

On Sun, Dec 13, 2009 at 11:18:01AM +0000, Matt Fleming wrote:
> pte_write() should check whether the permissions include either the user
> or kernel write permission bits. Likewise, pte_wrprotect() needs to
> remove both the kernel and user write bits.
> 
> Without this patch handle_tlbmiss() doesn't handle faulting in pages
> from the P3 area (our vmalloc space) because of a write. Mappings of the
> P3 space have the _PAGE_EXT_KERN_WRITE bit but not _PAGE_EXT_USER_WRITE.
> 
> Signed-off-by: Matt Fleming <matt@console-pimps.org>

Applied, thanks.

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

end of thread, other threads:[~2009-12-14  6:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-13 11:18 [PATCH] sh: Couple kernel and user write page perm bits for CONFIG_X2TLB Matt Fleming
2009-12-14  6:20 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).