]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - arch/x86/entry/vdso/vdso32-setup.c
Merge remote-tracking branch 'asoc/fix/cs4271' into asoc-linus
[mirror_ubuntu-eoan-kernel.git] / arch / x86 / entry / vdso / vdso32-setup.c
CommitLineData
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 27unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
e6e5494c 28
3d7ee969 29static int __init vdso32_setup(char *s)
e6e5494c 30{
3d7ee969 31 vdso32_enabled = simple_strtoul(s, NULL, 0);
e6e5494c 32
c06989da 33 if (vdso32_enabled > 1) {
b0b49f26 34 pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
c06989da
MK
35 vdso32_enabled = 0;
36 }
b0b49f26 37
e6e5494c
IM
38 return 1;
39}
40
af65d648
RM
41/*
42 * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
43 * behavior on both 64-bit and 32-bit kernels.
44 * On 32-bit kernels, vdso=[012] means the same thing.
45 */
3d7ee969 46__setup("vdso32=", vdso32_setup);
e6e5494c 47
af65d648 48#ifdef CONFIG_X86_32
3d7ee969 49__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
af65d648 50#endif
1da177e4 51
a6c4e076 52int __init sysenter_setup(void)
1da177e4 53{
0a6d1fa0 54 init_vdso_image(&vdso_image_32);
1da177e4 55
1da177e4
LT
56 return 0;
57}
e6e5494c 58
af65d648
RM
59#ifdef CONFIG_X86_64
60
d7a0380d 61subsys_initcall(sysenter_setup);
af65d648 62
a97f52e6
RM
63#ifdef CONFIG_SYSCTL
64/* Register vsyscall32 into the ABI table */
65#include <linux/sysctl.h>
66
c06989da
MK
67static const int zero;
68static const int one = 1;
69
f07d91ed 70static struct ctl_table abi_table2[] = {
a97f52e6
RM
71 {
72 .procname = "vsyscall32",
3d7ee969 73 .data = &vdso32_enabled,
a97f52e6
RM
74 .maxlen = sizeof(int),
75 .mode = 0644,
c06989da
MK
76 .proc_handler = proc_dointvec_minmax,
77 .extra1 = (int *)&zero,
78 .extra2 = (int *)&one,
a97f52e6
RM
79 },
80 {}
81};
82
f07d91ed 83static struct ctl_table abi_root_table2[] = {
a97f52e6 84 {
a97f52e6
RM
85 .procname = "abi",
86 .mode = 0555,
87 .child = abi_table2
88 },
89 {}
90};
91
92static __init int ia32_binfmt_init(void)
93{
94 register_sysctl_table(abi_root_table2);
95 return 0;
96}
97__initcall(ia32_binfmt_init);
a6c19dfe 98#endif /* CONFIG_SYSCTL */
af65d648
RM
99
100#endif /* CONFIG_X86_64 */