[PATCH] Bug in mremap

Eric W. Biederman (ebiederm+eric@ccr.net)
17 May 1999 22:14:54 -0500


While preparing a patch for 2.3, I happened to notice that
mremap (if it moves the mapping changes the offset into whats mapped)!

It does this with got 2.2.9 & 2.0.32.

The fact that this hasn't shown up before amazes me. The only
explanation I can think of this is both a linux specifc syscall
(so doesn't get used much) and only really useful for anonymous
pages (where the offset into the mapping doesn't matter anyway.

Eric

diff -uNrX linux-ignore-files linux-2.2.9/mm/mremap.c linux-2.2.9.eb1/mm/mremap.c
--- linux-2.2.9/mm/mremap.c Tue Feb 9 22:54:15 1999
+++ linux-2.2.9.eb1/mm/mremap.c Mon May 17 22:04:11 1999
@@ -133,7 +133,6 @@
*new_vma = *vma;
new_vma->vm_start = new_addr;
new_vma->vm_end = new_addr+new_len;
- new_vma->vm_offset = vma->vm_offset + (addr - vma->vm_start);
if (new_vma->vm_file)
new_vma->vm_file->f_count++;
if (new_vma->vm_ops && new_vma->vm_ops->open)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/