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

Commit a0abcf2e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'x86/vdso' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next

Pull x86 cdso updates from Peter Anvin:
 "Vdso cleanups and improvements largely from Andy Lutomirski.  This
  makes the vdso a lot less ''special''"

* 'x86/vdso' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/vdso, build: Make LE access macros clearer, host-safe
  x86/vdso, build: Fix cross-compilation from big-endian architectures
  x86/vdso, build: When vdso2c fails, unlink the output
  x86, vdso: Fix an OOPS accessing the HPET mapping w/o an HPET
  x86, mm: Replace arch_vma_name with vm_ops->name for vsyscalls
  x86, mm: Improve _install_special_mapping and fix x86 vdso naming
  mm, fs: Add vm_ops->name as an alternative to arch_vma_name
  x86, vdso: Fix an OOPS accessing the HPET mapping w/o an HPET
  x86, vdso: Remove vestiges of VDSO_PRELINK and some outdated comments
  x86, vdso: Move the vvar and hpet mappings next to the 64-bit vDSO
  x86, vdso: Move the 32-bit vdso special pages after the text
  x86, vdso: Reimplement vdso.so preparation in build-time C
  x86, vdso: Move syscall and sysenter setup into kernel/cpu/common.c
  x86, vdso: Clean up 32-bit vs 64-bit vdso params
  x86, mm: Ensure correct alignment of the fixmap
parents 2071b3e3 c191920f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -383,8 +383,8 @@ int ia32_setup_frame(int sig, struct ksignal *ksig,
	} else {
		/* Return stub is in 32bit vsyscall page */
		if (current->mm->context.vdso)
			restorer = VDSO32_SYMBOL(current->mm->context.vdso,
						 sigreturn);
			restorer = current->mm->context.vdso +
				selected_vdso32->sym___kernel_sigreturn;
		else
			restorer = &frame->retcode;
	}
@@ -462,8 +462,8 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
		if (ksig->ka.sa.sa_flags & SA_RESTORER)
			restorer = ksig->ka.sa.sa_restorer;
		else
			restorer = VDSO32_SYMBOL(current->mm->context.vdso,
						 rt_sigreturn);
			restorer = current->mm->context.vdso +
				selected_vdso32->sym___kernel_rt_sigreturn;
		put_user_ex(ptr_to_compat(restorer), &frame->pretcode);

		/*
+20 −15
Original line number Diff line number Diff line
@@ -75,7 +75,12 @@ typedef struct user_fxsr_struct elf_fpxregset_t;

#include <asm/vdso.h>

extern unsigned int vdso_enabled;
#ifdef CONFIG_X86_64
extern unsigned int vdso64_enabled;
#endif
#if defined(CONFIG_X86_32) || defined(CONFIG_COMPAT)
extern unsigned int vdso32_enabled;
#endif

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

struct task_struct;

#define	ARCH_DLINFO_IA32(vdso_enabled)					\
#define	ARCH_DLINFO_IA32						\
do {									\
	if (vdso_enabled) {						\
	if (vdso32_enabled) {						\
		NEW_AUX_ENT(AT_SYSINFO,	VDSO_ENTRY);			\
		NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE);	\
	}								\
@@ -281,7 +286,7 @@ do { \

#define STACK_RND_MASK (0x7ff)

#define ARCH_DLINFO		ARCH_DLINFO_IA32(vdso_enabled)
#define ARCH_DLINFO		ARCH_DLINFO_IA32

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

@@ -292,16 +297,17 @@ do { \

#define ARCH_DLINFO							\
do {									\
	if (vdso_enabled)						\
	if (vdso64_enabled)						\
		NEW_AUX_ENT(AT_SYSINFO_EHDR,				\
			    (unsigned long)current->mm->context.vdso);	\
			    (unsigned long __force)current->mm->context.vdso); \
} while (0)

/* As a historical oddity, the x32 and x86_64 vDSOs are controlled together. */
#define ARCH_DLINFO_X32							\
do {									\
	if (vdso_enabled)						\
	if (vdso64_enabled)						\
		NEW_AUX_ENT(AT_SYSINFO_EHDR,				\
			    (unsigned long)current->mm->context.vdso);	\
			    (unsigned long __force)current->mm->context.vdso); \
} while (0)

#define AT_SYSINFO		32
@@ -310,7 +316,7 @@ do { \
if (test_thread_flag(TIF_X32))						\
	ARCH_DLINFO_X32;						\
else									\
	ARCH_DLINFO_IA32(sysctl_vsyscall32)
	ARCH_DLINFO_IA32

#define COMPAT_ELF_ET_DYN_BASE	(TASK_UNMAPPED_BASE + 0x1000000)

@@ -319,18 +325,17 @@ else \
#define VDSO_CURRENT_BASE	((unsigned long)current->mm->context.vdso)

#define VDSO_ENTRY							\
	((unsigned long)VDSO32_SYMBOL(VDSO_CURRENT_BASE, vsyscall))
	((unsigned long)current->mm->context.vdso +			\
	 selected_vdso32->sym___kernel_vsyscall)

struct linux_binprm;

#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
extern int arch_setup_additional_pages(struct linux_binprm *bprm,
				       int uses_interp);
extern int x32_setup_additional_pages(struct linux_binprm *bprm,
extern int compat_arch_setup_additional_pages(struct linux_binprm *bprm,
					      int uses_interp);

extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
#define compat_arch_setup_additional_pages	syscall32_setup_pages
#define compat_arch_setup_additional_pages compat_arch_setup_additional_pages

extern unsigned long arch_randomize_brk(struct mm_struct *mm);
#define arch_randomize_brk arch_randomize_brk
+4 −7
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
#include <linux/threads.h>
#include <asm/kmap_types.h>
#else
#include <asm/vsyscall.h>
#include <uapi/asm/vsyscall.h>
#endif

/*
@@ -41,7 +41,8 @@
extern unsigned long __FIXADDR_TOP;
#define FIXADDR_TOP	((unsigned long)__FIXADDR_TOP)
#else
#define FIXADDR_TOP	(VSYSCALL_END-PAGE_SIZE)
#define FIXADDR_TOP	(round_up(VSYSCALL_ADDR + PAGE_SIZE, 1<<PMD_SHIFT) - \
			 PAGE_SIZE)
#endif


@@ -68,11 +69,7 @@ enum fixed_addresses {
#ifdef CONFIG_X86_32
	FIX_HOLE,
#else
	VSYSCALL_LAST_PAGE,
	VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
			    + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
	VVAR_PAGE,
	VSYSCALL_HPET,
	VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT,
#ifdef CONFIG_PARAVIRT_CLOCK
	PVCLOCK_FIXMAP_BEGIN,
	PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1,
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ typedef struct {
#endif

	struct mutex lock;
	void *vdso;
	void __user *vdso;
} mm_context_t;

#ifdef CONFIG_SMP
+0 −2
Original line number Diff line number Diff line
@@ -12,8 +12,6 @@ void ia32_syscall(void);
void ia32_cstar_target(void);
void ia32_sysenter_target(void);

void syscall32_cpu_init(void);

void x86_configure_nx(void);
void x86_report_nx(void);

Loading