[ARM] pxa: update defconfig for Verdex Pro
[linux-2.6/verdex.git] / arch / sh / kernel / vsyscall / vsyscall.c
blob3f7e415be86ade5ee681e11b174754d91f231d6b
1 /*
2 * arch/sh/kernel/vsyscall/vsyscall.c
4 * Copyright (C) 2006 Paul Mundt
6 * vDSO randomization
7 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
13 #include <linux/mm.h>
14 #include <linux/slab.h>
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/gfp.h>
18 #include <linux/module.h>
19 #include <linux/elf.h>
20 #include <linux/sched.h>
21 #include <linux/err.h>
24 * Should the kernel map a VDSO page into processes and pass its
25 * address down to glibc upon exec()?
27 unsigned int __read_mostly vdso_enabled = 1;
28 EXPORT_SYMBOL_GPL(vdso_enabled);
30 static int __init vdso_setup(char *s)
32 vdso_enabled = simple_strtoul(s, NULL, 0);
33 return 1;
35 __setup("vdso=", vdso_setup);
38 * These symbols are defined by vsyscall.o to mark the bounds
39 * of the ELF DSO images included therein.
41 extern const char vsyscall_trapa_start, vsyscall_trapa_end;
42 static struct page *syscall_pages[1];
44 int __init vsyscall_init(void)
46 void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
47 syscall_pages[0] = virt_to_page(syscall_page);
50 * XXX: Map this page to a fixmap entry if we get around
51 * to adding the page to ELF core dumps
54 memcpy(syscall_page,
55 &vsyscall_trapa_start,
56 &vsyscall_trapa_end - &vsyscall_trapa_start);
58 return 0;
61 /* Setup a VMA at program startup for the vsyscall page */
62 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
64 struct mm_struct *mm = current->mm;
65 unsigned long addr;
66 int ret;
68 down_write(&mm->mmap_sem);
69 addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
70 if (IS_ERR_VALUE(addr)) {
71 ret = addr;
72 goto up_fail;
75 ret = install_special_mapping(mm, addr, PAGE_SIZE,
76 VM_READ | VM_EXEC |
77 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
78 VM_ALWAYSDUMP,
79 syscall_pages);
80 if (unlikely(ret))
81 goto up_fail;
83 current->mm->context.vdso = (void *)addr;
85 up_fail:
86 up_write(&mm->mmap_sem);
87 return ret;
90 const char *arch_vma_name(struct vm_area_struct *vma)
92 if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
93 return "[vdso]";
95 return NULL;
98 struct vm_area_struct *get_gate_vma(struct task_struct *task)
100 return NULL;
103 int in_gate_area(struct task_struct *task, unsigned long address)
105 return 0;
108 int in_gate_area_no_task(unsigned long address)
110 return 0;