[patch 07/14] remap_file_pages protection support: support private vma for MAP_POPULATE
- From: blaisorblade@xxxxxxxx
- Date: Sun, 30 Apr 2006 19:30:00 +0200
From: Ingo Molnar <mingo@xxxxxxx>
Fix mmap(MAP_POPULATE | MAP_PRIVATE). We don't need the VMA to be shared if we
don't rearrange pages around. And it's trivial to do.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
Index: linux-2.6.git/mm/fremap.c
===================================================================
--- linux-2.6.git.orig/mm/fremap.c
+++ linux-2.6.git/mm/fremap.c
@@ -184,9 +184,6 @@ retry:
if (!vma)
goto out_unlock;
- if (!(vma->vm_flags & VM_SHARED))
- goto out_unlock;
-
if (!vma->vm_ops || !vma->vm_ops->populate)
goto out_unlock;
@@ -211,6 +208,8 @@ retry:
/* Must set VM_NONLINEAR before any pages are populated. */
if (pgoff != linear_page_index(vma, start) &&
!(vma->vm_flags & VM_NONLINEAR)) {
+ if (!(vma->vm_flags & VM_SHARED))
+ goto out_unlock;
if (!has_write_lock) {
up_read(&mm->mmap_sem);
down_write(&mm->mmap_sem);
@@ -229,6 +228,8 @@ retry:
if (pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot) &&
!(vma->vm_flags & VM_MANYPROTS)) {
+ if (!(vma->vm_flags & VM_SHARED))
+ goto out_unlock;
if (!has_write_lock) {
up_read(&mm->mmap_sem);
down_write(&mm->mmap_sem);
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
-
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/
- References:
- [patch 00/14] remap_file_pages protection support
- From: blaisorblade
- [patch 00/14] remap_file_pages protection support
- Prev by Date: [patch 09/14] remap_file_pages protection support: fix race condition with concurrent faults on same address space
- Next by Date: [patch 14/14] remap_file_pages protection support: adapt to uml peculiarities
- Previous by thread: [patch 09/14] remap_file_pages protection support: fix race condition with concurrent faults on same address space
- Next by thread: [patch 14/14] remap_file_pages protection support: adapt to uml peculiarities
- Index(es):
Relevant Pages
|