vdso32-setup.c 1.9 KB
Newer Older
L
Linus Torvalds 已提交
1 2
/*
 * (C) Copyright 2002 Linus Torvalds
3 4
 * Portions based on the vdso-randomization code from exec-shield:
 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
L
Linus Torvalds 已提交
5 6 7 8 9 10
 *
 * This file contains the needed initializations to support sysenter.
 */

#include <linux/init.h>
#include <linux/smp.h>
11 12
#include <linux/kernel.h>
#include <linux/mm_types.h>
L
Linus Torvalds 已提交
13 14

#include <asm/cpufeature.h>
15
#include <asm/processor.h>
R
Roland McGrath 已提交
16
#include <asm/vdso.h>
17 18

#ifdef CONFIG_COMPAT_VDSO
19
#define VDSO_DEFAULT	0
20
#else
21
#define VDSO_DEFAULT	1
22
#endif
L
Linus Torvalds 已提交
23

24 25 26 27
/*
 * Should the kernel map a VDSO page into processes and pass its
 * address down to glibc upon exec()?
 */
28
unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
29

30
static int __init vdso32_setup(char *s)
31
{
32
	vdso32_enabled = simple_strtoul(s, NULL, 0);
33

34
	if (vdso32_enabled > 1)
35 36
		pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");

37 38 39
	return 1;
}

R
Roland McGrath 已提交
40 41 42 43 44
/*
 * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
 * behavior on both 64-bit and 32-bit kernels.
 * On 32-bit kernels, vdso=[012] means the same thing.
 */
45
__setup("vdso32=", vdso32_setup);
46

R
Roland McGrath 已提交
47
#ifdef CONFIG_X86_32
48
__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
R
Roland McGrath 已提交
49
#endif
L
Linus Torvalds 已提交
50

51
int __init sysenter_setup(void)
L
Linus Torvalds 已提交
52
{
53
	init_vdso_image(&vdso_image_32);
L
Linus Torvalds 已提交
54 55 56

	return 0;
}
57

R
Roland McGrath 已提交
58 59
#ifdef CONFIG_X86_64

60
subsys_initcall(sysenter_setup);
R
Roland McGrath 已提交
61

R
Roland McGrath 已提交
62 63 64 65
#ifdef CONFIG_SYSCTL
/* Register vsyscall32 into the ABI table */
#include <linux/sysctl.h>

66
static struct ctl_table abi_table2[] = {
R
Roland McGrath 已提交
67 68
	{
		.procname	= "vsyscall32",
69
		.data		= &vdso32_enabled,
R
Roland McGrath 已提交
70 71 72 73 74 75 76
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec
	},
	{}
};

77
static struct ctl_table abi_root_table2[] = {
R
Roland McGrath 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91
	{
		.procname = "abi",
		.mode = 0555,
		.child = abi_table2
	},
	{}
};

static __init int ia32_binfmt_init(void)
{
	register_sysctl_table(abi_root_table2);
	return 0;
}
__initcall(ia32_binfmt_init);
92
#endif /* CONFIG_SYSCTL */
R
Roland McGrath 已提交
93 94

#endif	/* CONFIG_X86_64 */