From 10e4ecd30e69b6856c97a5d6b0cf4ce3dc2d093e Mon Sep 17 00:00:00 2001 From: David Woodhouse <dwmw2@infradead.org> Date: Fri, 4 Feb 2005 03:19:34 -0800 Subject: [PATCH] [PATCH] TASK_SIZE is variable. Bad things can happen if a 32-bit process is the last user of a 64-bit mm. TASK_SIZE isn't a constant, and we can end up clearing page tables only up to the 32-bit TASK_SIZE instead of all the way. We should probably double-check every instance of TASK_SIZE or USER_PTRS_PER_PGD for this kind of problem. We should also double-check that MM_VM_SIZE() and other such things are correctly defined on all architectures. I already fixed ppc64 which let it stay as TASK_SIZE, and hence dependent on the _current_ context instead of the mm in the argument. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org> --- mm/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 21329bf3dea3..3ba3f06728dc 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1612,8 +1612,8 @@ static void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *prev, unsigned long last = end + PGDIR_SIZE - 1; struct mm_struct *mm = tlb->mm; - if (last > TASK_SIZE || last < end) - last = TASK_SIZE; + if (last > MM_VM_SIZE(mm) || last < end) + last = MM_VM_SIZE(mm); if (!prev) { prev = mm->mmap; -- 2.30.9