Skip to content

Commit 70d5269

Browse files
t-8chjmberg-intel
authored andcommitted
x86/um: Do not inherit vDSO from host
Inheriting the vDSO from the host is problematic. The values read from the time functions will not be correct for the UML kernel. Furthermore the start and end of the vDSO are not stable or detectable by userspace. Specifically the vDSO datapages start before AT_SYSINFO_EHDR and the vDSO itself is larger than a single page. This codepath is only used on 32bit x86 UML. In my testing with both 32bit and 64bit hosts the passthrough functionality has always been disabled anyways due to the checks against envp in scan_elf_aux(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20251028-uml-remove-32bit-pseudo-vdso-v1-4-e930063eff5f@weissschuh.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 83b4b44 commit 70d5269

6 files changed

Lines changed: 3 additions & 139 deletions

File tree

arch/um/os-Linux/elf_aux.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,15 @@ typedef Elf32_auxv_t elf_auxv_t;
2020
/* These are initialized very early in boot and never changed */
2121
char * elf_aux_platform;
2222
extern long elf_aux_hwcap;
23-
unsigned long vsyscall_ehdr;
24-
unsigned long vsyscall_end;
25-
unsigned long __kernel_vsyscall;
2623

2724
__init void scan_elf_aux( char **envp)
2825
{
29-
long page_size = 0;
3026
elf_auxv_t * auxv;
3127

3228
while ( *envp++ != NULL) ;
3329

3430
for ( auxv = (elf_auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) {
3531
switch ( auxv->a_type ) {
36-
case AT_SYSINFO:
37-
__kernel_vsyscall = auxv->a_un.a_val;
38-
/* See if the page is under TASK_SIZE */
39-
if (__kernel_vsyscall < (unsigned long) envp)
40-
__kernel_vsyscall = 0;
41-
break;
42-
case AT_SYSINFO_EHDR:
43-
vsyscall_ehdr = auxv->a_un.a_val;
44-
/* See if the page is under TASK_SIZE */
45-
if (vsyscall_ehdr < (unsigned long) envp)
46-
vsyscall_ehdr = 0;
47-
break;
4832
case AT_HWCAP:
4933
elf_aux_hwcap = auxv->a_un.a_val;
5034
break;
@@ -56,17 +40,6 @@ __init void scan_elf_aux( char **envp)
5640
elf_aux_platform =
5741
(char *) (long) auxv->a_un.a_val;
5842
break;
59-
case AT_PAGESZ:
60-
page_size = auxv->a_un.a_val;
61-
break;
6243
}
6344
}
64-
if ( ! __kernel_vsyscall || ! vsyscall_ehdr ||
65-
! page_size || (vsyscall_ehdr % page_size) ) {
66-
__kernel_vsyscall = 0;
67-
vsyscall_ehdr = 0;
68-
}
69-
else {
70-
vsyscall_end = vsyscall_ehdr + page_size;
71-
}
7245
}

arch/um/os-Linux/user_syms.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ extern void *memset(void *, int, size_t);
3131
EXPORT_SYMBOL(memset);
3232
#endif
3333

34-
#ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
35-
/* needed for __access_ok() */
36-
EXPORT_SYMBOL(vsyscall_ehdr);
37-
EXPORT_SYMBOL(vsyscall_end);
38-
#endif
39-
4034
#ifdef _FORTIFY_SOURCE
4135
extern int __sprintf_chk(char *str, int flag, size_t len, const char *format);
4236
EXPORT_SYMBOL(__sprintf_chk);

arch/x86/um/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ endmenu
88

99
config UML_X86
1010
def_bool y
11-
select ARCH_BINFMT_ELF_EXTRA_PHDRS if X86_32
1211
select ARCH_USE_QUEUED_RWLOCKS
1312
select ARCH_USE_QUEUED_SPINLOCKS
1413
select DCACHE_WORD_ACCESS

arch/x86/um/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ obj-y = bugs_$(BITS).o delay.o fault.o \
1818
ifeq ($(CONFIG_X86_32),y)
1919

2020
obj-y += syscalls_32.o
21-
obj-$(CONFIG_ELF_CORE) += elfcore.o
2221

2322
subarch-y = ../lib/string_32.o ../lib/atomic64_32.o ../lib/atomic64_cx8_32.o
2423
subarch-y += ../lib/cmpxchg8b_emu.o ../lib/atomic64_386_32.o

arch/x86/um/asm/elf.h

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,9 @@ extern char * elf_aux_platform;
7272
#define ELF_PLATFORM_FALLBACK "i586"
7373
#define ELF_PLATFORM (elf_aux_platform ?: ELF_PLATFORM_FALLBACK)
7474

75-
extern unsigned long vsyscall_ehdr;
76-
extern unsigned long vsyscall_end;
77-
extern unsigned long __kernel_vsyscall;
78-
79-
/*
80-
* This is the range that is readable by user mode, and things
81-
* acting like user mode such as get_user_pages.
82-
*/
83-
#define FIXADDR_USER_START vsyscall_ehdr
84-
#define FIXADDR_USER_END vsyscall_end
85-
86-
87-
/*
88-
* Architecture-neutral AT_ values in 0-17, leave some room
89-
* for more of them, start the x86-specific ones at 32.
90-
*/
91-
#define AT_SYSINFO 32
92-
#define AT_SYSINFO_EHDR 33
93-
94-
#define ARCH_DLINFO \
95-
do { \
96-
if ( vsyscall_ehdr ) { \
97-
NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
98-
NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
99-
} \
100-
} while (0)
75+
/* No user-accessible fixmap addresses, i.e. vsyscall */
76+
#define FIXADDR_USER_START 0
77+
#define FIXADDR_USER_END 0
10178

10279
#else
10380

arch/x86/um/elfcore.c

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)