8 #include <linux/sched.h>
9 #include <linux/slab.h>
11 #include <linux/random.h>
12 #include <linux/elf.h>
25 static unsigned vdso_size;
27 #ifdef CONFIG_X86_X32_ABI
28 extern char vdsox32_start[], vdsox32_end[];
29 extern struct page *vdsox32_pages[];
30 static unsigned vdsox32_size;
32 static void __init patch_vdsox32(
void *vdso,
size_t len)
43 sechdrs = (
void *)hdr + hdr->
e_shoff;
46 for (i = 1; i < hdr->
e_shnum; i++) {
48 if (!
strcmp(secstrings + shdr->
sh_name,
".altinstructions")) {
55 pr_warning(
"patch_vdsox32: .altinstructions not found\n");
59 alt_data = (
void *)hdr + alt_sec->
sh_offset;
64 static void __init patch_vdso64(
void *vdso,
size_t len)
75 sechdrs = (
void *)hdr + hdr->
e_shoff;
78 for (i = 1; i < hdr->
e_shnum; i++) {
80 if (!
strcmp(secstrings + shdr->
sh_name,
".altinstructions")) {
87 pr_warning(
"patch_vdso64: .altinstructions not found\n");
91 alt_data = (
void *)hdr + alt_sec->
sh_offset;
95 static int __init init_vdso(
void)
100 patch_vdso64(vdso_start, vdso_end - vdso_start);
103 for (i = 0; i < npages; i++)
106 #ifdef CONFIG_X86_X32_ABI
107 patch_vdsox32(vdsox32_start, vdsox32_end - vdsox32_start);
108 npages = (vdsox32_end - vdsox32_start + PAGE_SIZE - 1) / PAGE_SIZE;
110 for (i = 0; i < npages; i++)
111 vdsox32_pages[i] =
virt_to_page(vdsox32_start + i*PAGE_SIZE);
124 static unsigned long vdso_addr(
unsigned long start,
unsigned len)
151 static int setup_additional_pages(
struct linux_binprm *bprm,
171 current->mm->context.vdso = (
void *)addr;
175 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
189 return setup_additional_pages(bprm, uses_interp, vdso_pages,
193 #ifdef CONFIG_X86_X32_ABI
196 return setup_additional_pages(bprm, uses_interp, vdsox32_pages,
201 static __init int vdso_setup(
char *
s)