]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 | 2 | * (C) Copyright 2002 Linus Torvalds |
e6e5494c IM |
3 | * Portions based on the vdso-randomization code from exec-shield: |
4 | * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar | |
1da177e4 LT |
5 | * |
6 | * This file contains the needed initializations to support sysenter. | |
7 | */ | |
8 | ||
9 | #include <linux/init.h> | |
10 | #include <linux/smp.h> | |
18d0a6fd AL |
11 | #include <linux/kernel.h> |
12 | #include <linux/mm_types.h> | |
1da177e4 | 13 | |
18d0a6fd | 14 | #include <asm/processor.h> |
6c3652ef | 15 | #include <asm/vdso.h> |
1dbf527c | 16 | |
1dbf527c | 17 | #ifdef CONFIG_COMPAT_VDSO |
b0b49f26 | 18 | #define VDSO_DEFAULT 0 |
1dbf527c | 19 | #else |
b0b49f26 | 20 | #define VDSO_DEFAULT 1 |
1dbf527c | 21 | #endif |
1da177e4 | 22 | |
e6e5494c IM |
23 | /* |
24 | * Should the kernel map a VDSO page into processes and pass its | |
25 | * address down to glibc upon exec()? | |
26 | */ | |
3d7ee969 | 27 | unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT; |
e6e5494c | 28 | |
3d7ee969 | 29 | static int __init vdso32_setup(char *s) |
e6e5494c | 30 | { |
3d7ee969 | 31 | vdso32_enabled = simple_strtoul(s, NULL, 0); |
e6e5494c | 32 | |
3d7ee969 | 33 | if (vdso32_enabled > 1) |
b0b49f26 AL |
34 | pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n"); |
35 | ||
e6e5494c IM |
36 | return 1; |
37 | } | |
38 | ||
af65d648 RM |
39 | /* |
40 | * For consistency, the argument vdso32=[012] affects the 32-bit vDSO | |
41 | * behavior on both 64-bit and 32-bit kernels. | |
42 | * On 32-bit kernels, vdso=[012] means the same thing. | |
43 | */ | |
3d7ee969 | 44 | __setup("vdso32=", vdso32_setup); |
e6e5494c | 45 | |
af65d648 | 46 | #ifdef CONFIG_X86_32 |
3d7ee969 | 47 | __setup_param("vdso=", vdso_setup, vdso32_setup, 0); |
af65d648 | 48 | #endif |
1da177e4 | 49 | |
a6c4e076 | 50 | int __init sysenter_setup(void) |
1da177e4 | 51 | { |
0a6d1fa0 | 52 | init_vdso_image(&vdso_image_32); |
1da177e4 | 53 | |
1da177e4 LT |
54 | return 0; |
55 | } | |
e6e5494c | 56 | |
af65d648 RM |
57 | #ifdef CONFIG_X86_64 |
58 | ||
d7a0380d | 59 | subsys_initcall(sysenter_setup); |
af65d648 | 60 | |
a97f52e6 RM |
61 | #ifdef CONFIG_SYSCTL |
62 | /* Register vsyscall32 into the ABI table */ | |
63 | #include <linux/sysctl.h> | |
64 | ||
f07d91ed | 65 | static struct ctl_table abi_table2[] = { |
a97f52e6 RM |
66 | { |
67 | .procname = "vsyscall32", | |
3d7ee969 | 68 | .data = &vdso32_enabled, |
a97f52e6 RM |
69 | .maxlen = sizeof(int), |
70 | .mode = 0644, | |
71 | .proc_handler = proc_dointvec | |
72 | }, | |
73 | {} | |
74 | }; | |
75 | ||
f07d91ed | 76 | static struct ctl_table abi_root_table2[] = { |
a97f52e6 | 77 | { |
a97f52e6 RM |
78 | .procname = "abi", |
79 | .mode = 0555, | |
80 | .child = abi_table2 | |
81 | }, | |
82 | {} | |
83 | }; | |
84 | ||
85 | static __init int ia32_binfmt_init(void) | |
86 | { | |
87 | register_sysctl_table(abi_root_table2); | |
88 | return 0; | |
89 | } | |
90 | __initcall(ia32_binfmt_init); | |
a6c19dfe | 91 | #endif /* CONFIG_SYSCTL */ |
af65d648 RM |
92 | |
93 | #endif /* CONFIG_X86_64 */ |