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