Skip to content

Commit 3d7ee96

Browse files
amlutoH. Peter Anvin
authored andcommitted
x86, vdso: Clean up 32-bit vs 64-bit vdso params
Rather than using 'vdso_enabled' and an awful #define, just call the parameters vdso32_enabled and vdso64_enabled. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Link: http://lkml.kernel.org/r/87913de56bdcbae3d93917938302fc369b05caee.1399317206.git.luto@amacapital.net Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 73159fd commit 3d7ee96

File tree

5 files changed

+30
-22
lines changed

5 files changed

+30
-22
lines changed

arch/x86/include/asm/elf.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
7575

7676
#include <asm/vdso.h>
7777

78-
extern unsigned int vdso_enabled;
78+
#ifdef CONFIG_X86_64
79+
extern unsigned int vdso64_enabled;
80+
#endif
81+
#if defined(CONFIG_X86_32) || defined(CONFIG_COMPAT)
82+
extern unsigned int vdso32_enabled;
83+
#endif
7984

8085
/*
8186
* This is used to ensure we don't load something for the wrong architecture.
@@ -269,9 +274,9 @@ extern int force_personality32;
269274

270275
struct task_struct;
271276

272-
#define ARCH_DLINFO_IA32(vdso_enabled) \
277+
#define ARCH_DLINFO_IA32 \
273278
do { \
274-
if (vdso_enabled) { \
279+
if (vdso32_enabled) { \
275280
NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \
276281
NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE); \
277282
} \
@@ -281,7 +286,7 @@ do { \
281286

282287
#define STACK_RND_MASK (0x7ff)
283288

284-
#define ARCH_DLINFO ARCH_DLINFO_IA32(vdso_enabled)
289+
#define ARCH_DLINFO ARCH_DLINFO_IA32
285290

286291
/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
287292

@@ -292,14 +297,15 @@ do { \
292297

293298
#define ARCH_DLINFO \
294299
do { \
295-
if (vdso_enabled) \
300+
if (vdso64_enabled) \
296301
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
297302
(unsigned long)current->mm->context.vdso); \
298303
} while (0)
299304

305+
/* As a historical oddity, the x32 and x86_64 vDSOs are controlled together. */
300306
#define ARCH_DLINFO_X32 \
301307
do { \
302-
if (vdso_enabled) \
308+
if (vdso64_enabled) \
303309
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
304310
(unsigned long)current->mm->context.vdso); \
305311
} while (0)
@@ -310,7 +316,7 @@ do { \
310316
if (test_thread_flag(TIF_X32)) \
311317
ARCH_DLINFO_X32; \
312318
else \
313-
ARCH_DLINFO_IA32(sysctl_vsyscall32)
319+
ARCH_DLINFO_IA32
314320

315321
#define COMPAT_ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
316322

arch/x86/um/vdso/vma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <asm/page.h>
1313
#include <linux/init.h>
1414

15-
unsigned int __read_mostly vdso_enabled = 1;
15+
static unsigned int __read_mostly vdso_enabled = 1;
1616
unsigned long um_vdso_addr;
1717

1818
extern unsigned long task_size;

arch/x86/vdso/vdso32-setup.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,20 @@
3737
#endif
3838

3939
#ifdef CONFIG_X86_64
40-
#define vdso_enabled sysctl_vsyscall32
4140
#define arch_setup_additional_pages syscall32_setup_pages
4241
#endif
4342

4443
/*
4544
* Should the kernel map a VDSO page into processes and pass its
4645
* address down to glibc upon exec()?
4746
*/
48-
unsigned int __read_mostly vdso_enabled = VDSO_DEFAULT;
47+
unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
4948

50-
static int __init vdso_setup(char *s)
49+
static int __init vdso32_setup(char *s)
5150
{
52-
vdso_enabled = simple_strtoul(s, NULL, 0);
51+
vdso32_enabled = simple_strtoul(s, NULL, 0);
5352

54-
if (vdso_enabled > 1)
53+
if (vdso32_enabled > 1)
5554
pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
5655

5756
return 1;
@@ -62,12 +61,10 @@ static int __init vdso_setup(char *s)
6261
* behavior on both 64-bit and 32-bit kernels.
6362
* On 32-bit kernels, vdso=[012] means the same thing.
6463
*/
65-
__setup("vdso32=", vdso_setup);
64+
__setup("vdso32=", vdso32_setup);
6665

6766
#ifdef CONFIG_X86_32
68-
__setup_param("vdso=", vdso32_setup, vdso_setup, 0);
69-
70-
EXPORT_SYMBOL_GPL(vdso_enabled);
67+
__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
7168
#endif
7269

7370
static struct page **vdso32_pages;
@@ -160,7 +157,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
160157
return x32_setup_additional_pages(bprm, uses_interp);
161158
#endif
162159

163-
if (vdso_enabled != 1) /* Other values all mean "disabled" */
160+
if (vdso32_enabled != 1) /* Other values all mean "disabled" */
164161
return 0;
165162

166163
down_write(&mm->mmap_sem);
@@ -244,7 +241,7 @@ subsys_initcall(sysenter_setup);
244241
static struct ctl_table abi_table2[] = {
245242
{
246243
.procname = "vsyscall32",
247-
.data = &sysctl_vsyscall32,
244+
.data = &vdso32_enabled,
248245
.maxlen = sizeof(int),
249246
.mode = 0644,
250247
.proc_handler = proc_dointvec

arch/x86/vdso/vma.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <asm/page.h>
1818

1919
#if defined(CONFIG_X86_64)
20-
unsigned int __read_mostly vdso_enabled = 1;
20+
unsigned int __read_mostly vdso64_enabled = 1;
2121

2222
DECLARE_VDSO_IMAGE(vdso);
2323
extern unsigned short vdso_sync_cpuid;
@@ -160,7 +160,7 @@ static int setup_additional_pages(struct linux_binprm *bprm,
160160
unsigned long addr;
161161
int ret;
162162

163-
if (!vdso_enabled)
163+
if (!vdso64_enabled)
164164
return 0;
165165

166166
down_write(&mm->mmap_sem);
@@ -203,7 +203,7 @@ int x32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
203203

204204
static __init int vdso_setup(char *s)
205205
{
206-
vdso_enabled = simple_strtoul(s, NULL, 0);
206+
vdso64_enabled = simple_strtoul(s, NULL, 0);
207207
return 0;
208208
}
209209
__setup("vdso=", vdso_setup);

kernel/sysctl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,8 +1418,13 @@ static struct ctl_table vm_table[] = {
14181418
(defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
14191419
{
14201420
.procname = "vdso_enabled",
1421+
#ifdef CONFIG_X86_32
1422+
.data = &vdso32_enabled,
1423+
.maxlen = sizeof(vdso32_enabled),
1424+
#else
14211425
.data = &vdso_enabled,
14221426
.maxlen = sizeof(vdso_enabled),
1427+
#endif
14231428
.mode = 0644,
14241429
.proc_handler = proc_dointvec,
14251430
.extra1 = &zero,

0 commit comments

Comments
 (0)