ia64/xen-unstable

changeset 8785:aefd8b8c6b1f

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).

Signed-off-by: Jan Beulich <JBeulich@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Feb 07 19:16:11 2006 +0100 (2006-02-07)
parents 581d4a0ac729
children e9d78d8bd568
files linux-2.6-xen-sparse/arch/x86_64/mm/pageattr-xen.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/pageattr-xen.c	Tue Feb 07 15:24:04 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/pageattr-xen.c	Tue Feb 07 19:16:11 2006 +0100
     1.3 @@ -40,7 +40,14 @@ static void mm_walk(struct mm_struct *mm
     1.4  	int          g,u,m;
     1.5  
     1.6  	pgd = mm->pgd;
     1.7 -	for (g = 0; g <= USER_PTRS_PER_PGD; g++, pgd++) {
     1.8 +	/*
     1.9 +	 * Cannot iterate up to USER_PTRS_PER_PGD as these pagetables may not
    1.10 +	 * be the 'current' task's pagetables (e.g., current may be 32-bit,
    1.11 +	 * but the pagetables may be for a 64-bit task).
    1.12 +	 * Subtracting 1 from TASK_SIZE64 means the loop limit is correct
    1.13 +	 * regardless of whether TASK_SIZE64 is a multiple of PGDIR_SIZE.
    1.14 +	 */
    1.15 +	for (g = 0; g <= ((TASK_SIZE64-1) / PGDIR_SIZE); g++, pgd++) {
    1.16  		if (pgd_none(*pgd))
    1.17  			continue;
    1.18  		pud = pud_offset(pgd, 0);