[PATCH] Miscellaneous mm fixes

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Sun, 22 Nov 1998 01:45:49 +0000


Linus,

These bug fixes against 2.1.129 are self explanatory. A couple of
typos, and some accounting fixes for mremap() of VM_LOCKED regions.

The lack of initialising mpnt->vm_pte in unmap_fixup is particularly bad
-- it screws up the reference counting for shared memory regions, and
worse when the field is overloaded as a private vma-specific data
pointer.

Enjoy,
-- Jamie

--- linux/arch/i386/mm/fault.c.devel Thu Nov 12 12:06:08 1998
+++ linux/arch/i386/mm/fault.c Sat Nov 21 23:05:49 1998
@@ -124,7 +124,7 @@
/*
* accessing the stack below %esp is always a bug.
* The "+ 32" is there due to some instructions (like
- * pusha) doing pre-decrement on the stack and that
+ * pusha) doing post-decrement on the stack and that
* doesn't show up until later..
*/
if (address + 32 < regs->esp)
--- linux/arch/i386/kernel/ptrace.c.devel Sun Oct 11 20:54:36 1998
+++ linux/arch/i386/kernel/ptrace.c Sun Nov 22 00:36:18 1998
@@ -476,7 +476,7 @@
if(addr == (long) &dummy->u_debugreg[4]) return -EIO;
if(addr == (long) &dummy->u_debugreg[5]) return -EIO;
if(addr < (long) &dummy->u_debugreg[4] &&
- ((unsigned long) data) >= 0xbffffffd) return -EIO;
+ ((unsigned long) data) >= TASK_SIZE-3) return -EIO;

ret = -EIO;
if(addr == (long) &dummy->u_debugreg[7]) {
--- linux/mm/mmap.c.devel Thu Nov 12 12:06:33 1998
+++ linux/mm/mmap.c Sat Nov 21 23:04:52 1998
@@ -432,6 +432,7 @@
mpnt->vm_ops = area->vm_ops;
mpnt->vm_offset = area->vm_offset + (end - area->vm_start);
mpnt->vm_file = area->vm_file;
+ mpnt->vm_pte = area->vm_pte;
if (mpnt->vm_file)
mpnt->vm_file->f_count++;
if (mpnt->vm_ops && mpnt->vm_ops->open)
--- linux/mm/mremap.c.devel Wed Aug 26 19:10:01 1998
+++ linux/mm/mremap.c Sun Nov 22 01:08:17 1998
@@ -142,7 +142,6 @@
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);
- new_vma->vm_file = vma->vm_file;
if (new_vma->vm_file)
new_vma->vm_file->f_count++;
if (new_vma->vm_ops && new_vma->vm_ops->open)
@@ -151,6 +150,11 @@
merge_segments(current->mm, new_vma->vm_start, new_vma->vm_end);
do_munmap(addr, old_len);
current->mm->total_vm += new_len >> PAGE_SHIFT;
+ if (new_vma->vm_flags & VM_LOCKED) {
+ current->mm->locked_vm += new_len >> PAGE_SHIFT;
+ make_pages_present(new_vma->vm_start,
+ new_vma->vm_end);
+ }
return new_addr;
}
kmem_cache_free(vm_area_cachep, new_vma);
@@ -224,8 +228,11 @@
int pages = (new_len - old_len) >> PAGE_SHIFT;
vma->vm_end = addr + new_len;
current->mm->total_vm += pages;
- if (vma->vm_flags & VM_LOCKED)
+ if (vma->vm_flags & VM_LOCKED) {
current->mm->locked_vm += pages;
+ make_pages_present(addr + old_len,
+ addr + new_len);
+ }
ret = addr;
goto out;
}

-
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/