Skip to contentSkip to conversation

UML - Fix pte bit collision

PATCH In review Jeff Dike 1 participant 1 message Mar 27, 2007 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 4/6 UML - Fix pte bit collision

From: Miklos Szeredi <[email protected]>

_PAGE_PROTNONE conflicts with the lowest bit of pgoff. This causes all sorts of weirdness when nonlinear mappings are used.

Took me a good half day to track this down.

--

 include/asm-um/pgtable-2level.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/asm-um/pgtable-2level.h +4 -4
Index: linux-2.6.21-mm/include/asm-um/pgtable-2level.h
===================================================================
@@ -45,12 +45,12 @@ static inline void pgd_mkuptodate(pgd_t 
 	((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
 
 /*
- * Bits 0 through 3 are taken
+ * Bits 0 through 4 are taken
  */
-#define PTE_FILE_MAX_BITS	28
+#define PTE_FILE_MAX_BITS	27
 
-#define pte_to_pgoff(pte) (pte_val(pte) >> 4)
+#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
 
-#define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE })
+#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
 
 #endif