1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/mm.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/gfp.h>
17#include <linux/module.h>
18#include <linux/elf.h>
19#include <linux/sched.h>
20#include <linux/err.h>
21
22
23
24
25
26unsigned int __read_mostly vdso_enabled = 1;
27EXPORT_SYMBOL_GPL(vdso_enabled);
28
29static int __init vdso_setup(char *s)
30{
31 vdso_enabled = simple_strtoul(s, NULL, 0);
32 return 1;
33}
34__setup("vdso=", vdso_setup);
35
36
37
38
39
40extern const char vsyscall_trapa_start, vsyscall_trapa_end;
41static struct page *syscall_pages[1];
42
43int __init vsyscall_init(void)
44{
45 void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
46 syscall_pages[0] = virt_to_page(syscall_page);
47
48
49
50
51
52
53 memcpy(syscall_page,
54 &vsyscall_trapa_start,
55 &vsyscall_trapa_end - &vsyscall_trapa_start);
56
57 return 0;
58}
59
60
61int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
62{
63 struct mm_struct *mm = current->mm;
64 unsigned long addr;
65 int ret;
66
67 down_write(&mm->mmap_sem);
68 addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
69 if (IS_ERR_VALUE(addr)) {
70 ret = addr;
71 goto up_fail;
72 }
73
74 ret = install_special_mapping(mm, addr, PAGE_SIZE,
75 VM_READ | VM_EXEC |
76 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
77 VM_ALWAYSDUMP,
78 syscall_pages);
79 if (unlikely(ret))
80 goto up_fail;
81
82 current->mm->context.vdso = (void *)addr;
83
84up_fail:
85 up_write(&mm->mmap_sem);
86 return ret;
87}
88
89const char *arch_vma_name(struct vm_area_struct *vma)
90{
91 if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
92 return "[vdso]";
93
94 return NULL;
95}
96
97struct vm_area_struct *get_gate_vma(struct task_struct *task)
98{
99 return NULL;
100}
101
102int in_gate_area(struct task_struct *task, unsigned long address)
103{
104 return 0;
105}
106
107int in_gate_area_no_task(unsigned long address)
108{
109 return 0;
110}
111