[PATCH 1/6] fork vma order

From: Hugh Dickins
Date: Tue Mar 30 2004 - 17:52:18 EST


First of six patches against 2.6.5-rc3, cleaning up mremap's move_vma,
and fixing truncation orphan issues raised by Rajesh Venkatasubramanian.
Originally done as part of the anonymous objrmap work on mremap move,
but useful fixes now extracted for mainline. The mremap changes need
some exposure in the -mm tree first, but the first (fork one-liner)
is safe enough to go straight into 2.6.5.

include/linux/mm.h | 3
kernel/fork.c | 2
mm/mmap.c | 70 ++++++++++++++--
mm/mremap.c | 221 +++++++++++++++++++----------------------------------
mm/rmap.c | 3
5 files changed, 149 insertions(+), 150 deletions(-)

[PATCH] 1/6 fork vma order

>From Rajesh Venkatasubramanian: despite the comment that child vma
should be inserted just after parent vma, 2.5.6 did exactly the reverse:
thus a racing vmtruncate may free the child's ptes, then advance to the
parent, and meanwhile copy_page_range has propagated more ptes from the
parent to the child, leaving file pages still mapped after truncation.

--- 2.6.5-rc3/kernel/fork.c 2004-03-11 01:56:07.000000000 +0000
+++ mremap1/kernel/fork.c 2004-03-30 21:24:25.839880544 +0100
@@ -322,7 +322,7 @@ static inline int dup_mmap(struct mm_str

/* insert tmp into the share list, just after mpnt */
down(&file->f_mapping->i_shared_sem);
- list_add_tail(&tmp->shared, &mpnt->shared);
+ list_add(&tmp->shared, &mpnt->shared);
up(&file->f_mapping->i_shared_sem);
}


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