~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/um/vdso/vma.c

Version: ~ [ linux-5.1-rc2 ] ~ [ linux-5.0.4 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.31 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.108 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.165 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.177 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.137 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.63 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  */
  8 
  9 #include <linux/slab.h>
 10 #include <linux/sched.h>
 11 #include <linux/mm.h>
 12 #include <asm/page.h>
 13 #include <asm/elf.h>
 14 #include <linux/init.h>
 15 
 16 static unsigned int __read_mostly vdso_enabled = 1;
 17 unsigned long um_vdso_addr;
 18 
 19 extern unsigned long task_size;
 20 extern char vdso_start[], vdso_end[];
 21 
 22 static struct page **vdsop;
 23 
 24 static int __init init_vdso(void)
 25 {
 26         struct page *um_vdso;
 27 
 28         BUG_ON(vdso_end - vdso_start > PAGE_SIZE);
 29 
 30         um_vdso_addr = task_size - PAGE_SIZE;
 31 
 32         vdsop = kmalloc(sizeof(struct page *), GFP_KERNEL);
 33         if (!vdsop)
 34                 goto oom;
 35 
 36         um_vdso = alloc_page(GFP_KERNEL);
 37         if (!um_vdso) {
 38                 kfree(vdsop);
 39 
 40                 goto oom;
 41         }
 42 
 43         copy_page(page_address(um_vdso), vdso_start);
 44         *vdsop = um_vdso;
 45 
 46         return 0;
 47 
 48 oom:
 49         printk(KERN_ERR "Cannot allocate vdso\n");
 50         vdso_enabled = 0;
 51 
 52         return -ENOMEM;
 53 }
 54 subsys_initcall(init_vdso);
 55 
 56 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 57 {
 58         int err;
 59         struct mm_struct *mm = current->mm;
 60 
 61         if (!vdso_enabled)
 62                 return 0;
 63 
 64         if (down_write_killable(&mm->mmap_sem))
 65                 return -EINTR;
 66 
 67         err = install_special_mapping(mm, um_vdso_addr, PAGE_SIZE,
 68                 VM_READ|VM_EXEC|
 69                 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 70                 vdsop);
 71 
 72         up_write(&mm->mmap_sem);
 73 
 74         return err;
 75 }
 76 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp