Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3100e448 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 vdso updates from Ingo Molnar:
 "Various vDSO updates from Andy Lutomirski, mostly cleanups and
  reorganization to improve maintainability, but also some
  micro-optimizations and robustization changes"

* 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86_64/vsyscall: Restore orig_ax after vsyscall seccomp
  x86_64: Add a comment explaining the TASK_SIZE_MAX guard page
  x86_64,vsyscall: Make vsyscall emulation configurable
  x86_64, vsyscall: Rewrite comment and clean up headers in vsyscall code
  x86_64, vsyscall: Turn vsyscalls all the way off when vsyscall==none
  x86,vdso: Use LSL unconditionally for vgetcpu
  x86: vdso: Fix build with older gcc
  x86_64/vdso: Clean up vgetcpu init and merge the vdso initcalls
  x86_64/vdso: Remove jiffies from the vvar page
  x86/vdso: Make the PER_CPU segment 32 bits
  x86/vdso: Make the PER_CPU segment start out accessed
  x86/vdso: Change the PER_CPU segment to use struct desc_struct
  x86_64/vdso: Move getcpu code from vsyscall_64.c to vdso/vma.c
  x86_64/vsyscall: Move all of the gate_area code to vsyscall_64.c
parents c9f861c7 26893107
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -992,6 +992,24 @@ config X86_ESPFIX64
	def_bool y
	depends on X86_16BIT && X86_64

config X86_VSYSCALL_EMULATION
       bool "Enable vsyscall emulation" if EXPERT
       default y
       depends on X86_64
       ---help---
	 This enables emulation of the legacy vsyscall page.  Disabling
	 it is roughly equivalent to booting with vsyscall=none, except
	 that it will also disable the helpful warning if a program
	 tries to use a vsyscall.  With this option set to N, offending
	 programs will just segfault, citing addresses of the form
	 0xffffffffff600?00.

	 This option is required by many programs built before 2013, and
	 care should be used even with newer programs if set to N.

	 Disabling this option saves about 7K of kernel size and
	 possibly 4K of additional runtime pagetable memory.

config TOSHIBA
	tristate "Toshiba Laptop support"
	depends on X86_32
+2 −0
Original line number Diff line number Diff line
@@ -69,7 +69,9 @@ enum fixed_addresses {
#ifdef CONFIG_X86_32
	FIX_HOLE,
#else
#ifdef CONFIG_X86_VSYSCALL_EMULATION
	VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT,
#endif
#ifdef CONFIG_PARAVIRT_CLOCK
	PVCLOCK_FIXMAP_BEGIN,
	PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1,
+3 −1
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ void copy_page(void *to, void *from);

#endif	/* !__ASSEMBLY__ */

#ifdef CONFIG_X86_VSYSCALL_EMULATION
# define __HAVE_ARCH_GATE_AREA 1
#endif

#endif /* _ASM_X86_PAGE_64_H */
+7 −1
Original line number Diff line number Diff line
@@ -894,7 +894,13 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);

#else
/*
 * User space process size. 47bits minus one guard page.
 * User space process size. 47bits minus one guard page.  The guard
 * page is necessary on Intel CPUs: if a SYSCALL instruction is at
 * the highest possible canonical userspace address, then that
 * syscall will enter the kernel with a non-canonical return
 * address, and SYSRET will explode dangerously.  We avoid this
 * particular problem by preventing anything from being mapped
 * at the maximum canonical address.
 */
#define TASK_SIZE_MAX	((1UL << 47) - PAGE_SIZE)

+19 −0
Original line number Diff line number Diff line
@@ -70,4 +70,23 @@ static inline void gtod_write_end(struct vsyscall_gtod_data *s)
	++s->seq;
}

#ifdef CONFIG_X86_64

#define VGETCPU_CPU_MASK 0xfff

static inline unsigned int __getcpu(void)
{
	unsigned int p;

	/*
	 * Load per CPU data from GDT.  LSL is faster than RDTSCP and
	 * works on all CPUs.
	 */
	asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));

	return p;
}

#endif /* CONFIG_X86_64 */

#endif /* _ASM_X86_VGTOD_H */
Loading