public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* TASK_SIZE is variable.
@ 2005-01-25 22:26 David Woodhouse
  2005-01-25 23:52 ` David S. Miller
  2005-01-29 20:23 ` Andrew Morton
  0 siblings, 2 replies; 32+ messages in thread
From: David Woodhouse @ 2005-01-25 22:26 UTC (permalink / raw)
  To: linux-arch

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.

--- mm/mmap.c.orig	2005-01-25 22:23:02.030427272 +0000
+++ mm/mmap.c	2005-01-25 22:23:55.627279312 +0000
@@ -1612,8 +1612,8 @@ static void free_pgtables(struct mmu_gat
 	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;
@@ -1996,7 +1996,7 @@ void exit_mmap(struct mm_struct *mm)
 	vm_unacct_memory(nr_accounted);
 	BUG_ON(mm->map_count);	/* This is just debugging */
 	clear_page_range(tlb, FIRST_USER_PGD_NR * PGDIR_SIZE,
-			(TASK_SIZE + PGDIR_SIZE - 1) & PGDIR_MASK);
+			(MM_VM_SIZE(mm) + PGDIR_SIZE - 1) & PGDIR_MASK);
 	
 	tlb_finish_mmu(tlb, 0, MM_VM_SIZE(mm));
 

-- 
dwmw2

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

end of thread, other threads:[~2005-02-03  9:23 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-25 22:26 TASK_SIZE is variable David Woodhouse
2005-01-25 23:52 ` David S. Miller
2005-01-26  6:36   ` Andi Kleen
2005-01-26  6:41     ` David S. Miller
2005-01-26  7:13       ` Andi Kleen
2005-01-26  7:24         ` Andrew Morton
2005-01-26  7:43           ` Andi Kleen
2005-01-26  8:01             ` Andrew Morton
2005-01-26  8:04               ` Andi Kleen
2005-01-28  2:58               ` Paul Mackerras
2005-01-28  3:11                 ` Paul Mackerras
2005-01-28  3:17                   ` Andrew Morton
2005-01-28  6:40                     ` Andi Kleen
2005-01-29 11:23                       ` Anton Blanchard
2005-01-28  8:46                     ` Russell King
2005-01-28  6:39                 ` Andi Kleen
2005-01-28 11:32                   ` David Woodhouse
2005-01-26  7:54   ` David Woodhouse
2005-01-29 20:23 ` Andrew Morton
2005-01-29 23:28   ` Paul Mackerras
2005-01-30 11:01     ` Andi Kleen
2005-01-30 12:10       ` Paul Mackerras
2005-01-31  2:23         ` David S. Miller
2005-01-31  9:23           ` Andi Kleen
2005-01-31 19:29             ` David S. Miller
2005-01-31 19:38               ` Andi Kleen
2005-01-31 20:35                 ` David S. Miller
2005-02-03  4:08                   ` Andrew Morton
2005-02-03  6:28                     ` David S. Miller
2005-02-03  7:19                       ` Andi Kleen
2005-02-03  9:23                         ` David Woodhouse
2005-01-31  2:33     ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox