Skip to contentSkip to conversation

x86_64 linux: don't use USER_PTRS_PER_PGD in mm_walk()

PATCH New Jan Beulich 1 participant 1 message Feb 7, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86_64 linux: don't use USER_PTRS_PER_PGD in mm_walk()

Since USER_PTRS_PER_PGD depends on TASK_SIZE and thus on the current thread, it must not be used in code that can be called in the context switch path (otherwise the 32-bitness of the outgoing task is used here rather then the 32-bitness of the incoming one, possibly resulting in large parts of the page tables not getting converted to read-only).

Jan

arch/x86_64/mm/pageattr-xen.c +1 -1
@@ -40,7 +40,7 @@ static void mm_walk(struct mm_struct *mm
 	int          g,u,m;
 
 	pgd = mm->pgd;
-	for (g = 0; g <= USER_PTRS_PER_PGD; g++, pgd++) {
+	for (g = 0; g <= (TASK_SIZE64 - 1) / PGDIR_SIZE; g++, pgd++) {
 		if (pgd_none(*pgd))
 			continue;
 		pud = pud_offset(pgd, 0);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel