Re: Linux 1.3.36: 'bforget' is flawed

Michael Elizabeth Chastain (mec@duracef.shout.net)
Mon, 6 Nov 1995 10:28:45 -0600


Linus Torvalds writes:

> I do have patches for this now, but I'll keep them for a while pending a
> few cleanups. I'm appending the current working set in this mail, BUT
> BE VERY CAREFUL. I haven't actually tested this (and my final patches
> should actually do some things slightly differently).

Foo! I just finished writing and testing my own patch. Ok, I will
proof-read yours, instead.

I see two problems here:

--- v1.3.37/linux/mm/mmap.c Wed Sep 13 12:45:34 1995
+++ linux/mm/mmap.c Mon Nov 6 16:02:38 1995
@@ -768,7 +768,7 @@

if (mpnt->vm_ops && mpnt->vm_ops->unmap)
mpnt->vm_ops->unmap(mpnt, st, end-st);
-
+ zap_page_range(current->mm, addr, end-addr);
unmap_fixup(mpnt, st, end-st);
kfree(mpnt);
}

First, I think this should be 'zap_page_range(current->mm, st, end-st)'.
'addr' and 'len' refer to the entire argument to 'munmap', while 'st'
and 'end' refer to the portion of it which overlaps with 'mpnt'.

Second, there is a call to 'unmap_page_range' right after this loop,
which I think needs to be removed now that 'zap_page_range' is in the
loop.

Michael Chastain
mec@duracef.shout.net
ftp://tsx-11.mit.edu/pub/linux/sources/usr.bin/mec-0.2.tar.gz