Skip to content

Commit 87983c6

Browse files
amlutoKAGA-KOKO
authored andcommitted
x86_64, vsyscall: Turn vsyscalls all the way off when vsyscall==none
I see no point in having an unusable read-only page sitting at 0xffffffffff600000 when vsyscall=none. Instead, skip mapping it and remove it from /proc/PID/maps. I kept the ratelimited warning when programs try to use a vsyscall in this mode, since it may help admins avoid confusion. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Link: http://lkml.kernel.org/r/0dddbadc1d4e3bfbaf887938ff42afc97a7cc1f2.1414618407.git.luto@amacapital.net Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent e76b027 commit 87983c6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

arch/x86/kernel/vsyscall_64.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
307307
if (!mm || mm->context.ia32_compat)
308308
return NULL;
309309
#endif
310+
if (vsyscall_mode == NONE)
311+
return NULL;
310312
return &gate_vma;
311313
}
312314

@@ -327,18 +329,20 @@ int in_gate_area(struct mm_struct *mm, unsigned long addr)
327329
*/
328330
int in_gate_area_no_mm(unsigned long addr)
329331
{
330-
return (addr & PAGE_MASK) == VSYSCALL_ADDR;
332+
return vsyscall_mode != NONE && (addr & PAGE_MASK) == VSYSCALL_ADDR;
331333
}
332334

333335
void __init map_vsyscall(void)
334336
{
335337
extern char __vsyscall_page;
336338
unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
337339

338-
__set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
339-
vsyscall_mode == NATIVE
340-
? PAGE_KERNEL_VSYSCALL
341-
: PAGE_KERNEL_VVAR);
340+
if (vsyscall_mode != NONE)
341+
__set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
342+
vsyscall_mode == NATIVE
343+
? PAGE_KERNEL_VSYSCALL
344+
: PAGE_KERNEL_VVAR);
345+
342346
BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) !=
343347
(unsigned long)VSYSCALL_ADDR);
344348
}

0 commit comments

Comments
 (0)