[PATCH 2/3] Pass vma argument to copy_user_highpage().

From: Ralf Baechle
Date: Thu Oct 19 2006 - 12:36:29 EST


From: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>

To allow a more effective copy_user_highpage() on certain architectures,
a vma argument is added to the function and cow_user_page() allowing
the implementation of these functions to check for the VM_EXEC bit.

The main part of this patch was originally written by Ralf Baechle;
Atushi Nemoto did the the debugging.

Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
Signed-off-by: Ralf Baechle <ralf@xxxxxxxxxxxxxx>

include/linux/highmem.h | 3 ++-
mm/memory.c | 10 +++++-----
2 files changed, 7 insertions(+), 6 deletions(-)

Index: upstream-linus/mm/memory.c
===================================================================
--- upstream-linus.orig/mm/memory.c 2006-10-17 00:14:41.000000000 +0100
+++ upstream-linus/mm/memory.c 2006-10-17 00:15:40.000000000 +0100
@@ -1431,7 +1431,7 @@ static inline pte_t maybe_mkwrite(pte_t
return pte;
}

-static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va)
+static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma)
{
/*
* If the source page was a PFN mapping, we don't have
@@ -1453,9 +1453,9 @@ static inline void cow_user_page(struct
memset(kaddr, 0, PAGE_SIZE);
kunmap_atomic(kaddr, KM_USER0);
return;
-
+
}
- copy_user_highpage(dst, src, va);
+ copy_user_highpage(dst, src, va, vma);
}

/*
@@ -1566,7 +1566,7 @@ gotten:
new_page = alloc_page_vma(GFP_HIGHUSER, vma, address);
if (!new_page)
goto oom;
- cow_user_page(new_page, old_page, address);
+ cow_user_page(new_page, old_page, address, vma);
}

/*
@@ -2190,7 +2190,7 @@ retry:
page = alloc_page_vma(GFP_HIGHUSER, vma, address);
if (!page)
goto oom;
- copy_user_highpage(page, new_page, address);
+ copy_user_highpage(page, new_page, address, vma);
page_cache_release(new_page);
new_page = page;
anon = 1;
Index: upstream-linus/include/linux/highmem.h
===================================================================
--- upstream-linus.orig/include/linux/highmem.h 2006-10-17 00:15:21.000000000 +0100
+++ upstream-linus/include/linux/highmem.h 2006-10-17 00:17:23.000000000 +0100
@@ -96,7 +96,8 @@ static inline void memclear_highpage_flu

#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE

-static inline void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr)
+static inline void copy_user_highpage(struct page *to, struct page *from,
+ unsigned long vaddr, struct vm_area_struct *vma)
{
char *vfrom, *vto;

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