#include <linux/types.h>
#include <linux/mm.h>
#include <linux/security.h>
-#include <linux/mempolicy.h>
#include <asm/param.h>
#include <asm/signal.h>
return -ENOMEM;
}
+ memset(mpnt, 0, sizeof(*mpnt));
+
down_write(¤t->mm->mmap_sem);
{
mpnt->vm_mm = current->mm;
mpnt->vm_flags = VM_STACK_FLAGS;
mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC)?
PAGE_COPY_EXEC: PAGE_COPY;
- mpnt->vm_ops = NULL;
- mpnt->vm_pgoff = 0;
- mpnt->vm_file = NULL;
- mpnt->vm_private_data = 0;
- mpol_set_vma_default(mpnt);
insert_vm_struct(current->mm, mpnt);
current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
}
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
- put_dirty_page(current, page, stack_base, mpnt->vm_page_prot);
+ install_arg_page(mpnt, page, stack_base);
}
stack_base += PAGE_SIZE;
}
#include <linux/pagemap.h>
#include <linux/mount.h>
#include <linux/version.h>
-#include <linux/mempolicy.h>
#include <asm/bitops.h>
#include <asm/errno.h>
#include <linux/slab.h>
#include <linux/swap.h>
#include <linux/proc_fs.h>
-#include <linux/mempolicy.h>
#include <asm/a.out.h>
#include <asm/bitops.h>
}
/*
- * This is like put_dirty_page() but installs a clean page in the kernel's page table.
+ * This installs a clean page in the kernel's page table.
*/
struct page *
put_kernel_page (struct page *page, unsigned long address, pgprot_t pgprot)
return -ENOMEM;
}
+ memset(mpnt, 0, sizeof(*mpnt));
+
down_write(&mm->mmap_sem);
{
mpnt->vm_mm = mm;
/* executable stack setting would be applied here */
mpnt->vm_page_prot = PAGE_COPY;
mpnt->vm_flags = VM_STACK_FLAGS;
- mpnt->vm_ops = NULL;
- mpnt->vm_pgoff = 0;
- mpnt->vm_file = NULL;
- mpol_set_vma_default(mpnt);
- mpnt->vm_private_data = (void *) 0;
insert_vm_struct(mm, mpnt);
mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
}
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
- put_dirty_page(current,page,stack_base,PAGE_COPY);
+ install_arg_page(mpnt, page, stack_base);
}
stack_base += PAGE_SIZE;
}
#include <linux/binfmts.h>
#include <linux/mm.h>
#include <linux/security.h>
-#include <linux/mempolicy.h>
#include <asm/segment.h>
#include <asm/ptrace.h>
return -ENOMEM;
}
+ memset(mpnt, 0, sizeof(*mpnt));
+
down_write(&mm->mmap_sem);
{
mpnt->vm_mm = mm;
mpnt->vm_flags = vm_stack_flags32;
mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC) ?
PAGE_COPY_EXEC : PAGE_COPY;
- mpnt->vm_ops = NULL;
- mpnt->vm_pgoff = 0;
- mpnt->vm_file = NULL;
- mpol_set_vma_default(mpnt);
- mpnt->vm_private_data = (void *) 0;
insert_vm_struct(mm, mpnt);
mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
}
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
- put_dirty_page(current,page,stack_base,mpnt->vm_page_prot);
+ install_arg_page(mpnt, page, stack_base);
}
stack_base += PAGE_SIZE;
}
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/rmap.h>
-#include <linux/mempolicy.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
* This routine is used to map in a page into an address space: needed by
* execve() for the initial stack and environment pages.
*
- * tsk->mm->mmap_sem is held for writing.
+ * vma->vm_mm->mmap_sem is held for writing.
*/
-void put_dirty_page(struct task_struct *tsk, struct page *page,
- unsigned long address, pgprot_t prot)
+void install_arg_page(struct vm_area_struct *vma,
+ struct page *page, unsigned long address)
{
- struct mm_struct *mm = tsk->mm;
+ struct mm_struct *mm = vma->vm_mm;
pgd_t * pgd;
pmd_t * pmd;
pte_t * pte;
+ flush_dcache_page(page);
pgd = pgd_offset(mm, address);
+
spin_lock(&mm->page_table_lock);
pmd = pmd_alloc(mm, pgd, address);
if (!pmd)
}
mm->rss++;
lru_cache_add_active(page);
- flush_dcache_page(page);
- set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, prot))));
+ set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(
+ page, vma->vm_page_prot))));
page_add_anon_rmap(page, mm, address);
pte_unmap(pte);
spin_unlock(&mm->page_table_lock);
out:
spin_unlock(&mm->page_table_lock);
__free_page(page);
- force_sig(SIGKILL, tsk);
+ force_sig(SIGKILL, current);
}
int setup_arg_pages(struct linux_binprm *bprm, int executable_stack)
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
- put_dirty_page(current, page, stack_base,
- mpnt->vm_page_prot);
+ install_arg_page(mpnt, page, stack_base);
}
stack_base += PAGE_SIZE;
}
extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
extern int make_pages_present(unsigned long addr, unsigned long end);
extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
-void put_dirty_page(struct task_struct *tsk, struct page *page,
- unsigned long address, pgprot_t prot);
+void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);