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

Commit 98a96f20 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:
 "Further simplifications and improvements to the VDSO code, by Andy
  Lutomirski"

* 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86_64/vsyscall: Fix warn_bad_vsyscall log output
  x86/vdso: Set VM_MAYREAD for the vvar vma
  x86, vdso: Get rid of the fake section mechanism
  x86, vdso: Move the vvar area before the vdso text
parents 5637a2a3 53b884ac
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -18,15 +18,15 @@ struct vdso_image {

	unsigned long alt, alt_len;

	unsigned long sym_end_mapping;  /* Total size of the mapping */

	unsigned long sym_vvar_page;
	unsigned long sym_hpet_page;
	unsigned long sym_VDSO32_NOTE_MASK;
	unsigned long sym___kernel_sigreturn;
	unsigned long sym___kernel_rt_sigreturn;
	unsigned long sym___kernel_vsyscall;
	unsigned long sym_VDSO32_SYSENTER_RETURN;
	long sym_vvar_start;  /* Negative offset to the vvar area */

	long sym_vvar_page;
	long sym_hpet_page;
	long sym_VDSO32_NOTE_MASK;
	long sym___kernel_sigreturn;
	long sym___kernel_rt_sigreturn;
	long sym___kernel_vsyscall;
	long sym_VDSO32_SYSENTER_RETURN;
};

#ifdef CONFIG_X86_64
+4 −4
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,
	if (!show_unhandled_signals)
		return;

	pr_notice_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
	printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
			   level, current->comm, task_pid_nr(current),
			   message, regs->ip, regs->cs,
			   regs->sp, regs->ax, regs->si, regs->di);
+10 −6
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ VDSO32-$(CONFIG_X86_32) := y
VDSO32-$(CONFIG_COMPAT)		:= y

# files to link into the vdso
vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o
vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o

# files to link into kernel
obj-y				+= vma.o
@@ -37,7 +37,8 @@ vdso_img_sodbg := $(vdso_img-y:%=vdso%.so.dbg)
obj-y += $(vdso_img_objs)
targets += $(vdso_img_cfiles)
targets += $(vdso_img_sodbg)
.SECONDARY: $(vdso_img-y:%=$(obj)/vdso-image-%.c)
.SECONDARY: $(vdso_img-y:%=$(obj)/vdso-image-%.c) \
	$(vdso_img-y:%=$(obj)/vdso%.so)

export CPPFLAGS_vdso.lds += -P -C

@@ -54,10 +55,10 @@ hostprogs-y += vdso2c

quiet_cmd_vdso2c = VDSO2C  $@
define cmd_vdso2c
	$(obj)/vdso2c $< $@
	$(obj)/vdso2c $< $(<:%.dbg=%) $@
endef

$(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso2c FORCE
$(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso%.so $(obj)/vdso2c FORCE
	$(call if_changed,vdso2c)

#
@@ -113,6 +114,10 @@ $(obj)/%-x32.o: $(obj)/%.o FORCE

targets += vdsox32.lds $(vobjx32s-y)

$(obj)/%.so: OBJCOPYFLAGS := -S
$(obj)/%.so: $(obj)/%.so.dbg
	$(call if_changed,objcopy)

$(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
	$(call if_changed,vdso)

@@ -134,7 +139,7 @@ override obj-dirs = $(dir $(obj)) $(obj)/vdso32/

targets += vdso32/vdso32.lds
targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o)
targets += vdso32/vclock_gettime.o vdso32/vdso-fakesections.o
targets += vdso32/vclock_gettime.o

$(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%)

@@ -156,7 +161,6 @@ $(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
$(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
				 $(obj)/vdso32/vdso32.lds \
				 $(obj)/vdso32/vclock_gettime.o \
				 $(obj)/vdso32/vdso-fakesections.o \
				 $(obj)/vdso32/note.o \
				 $(obj)/vdso32/%.o
	$(call if_changed,vdso)

arch/x86/vdso/vdso-fakesections.c

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
/*
 * Copyright 2014 Andy Lutomirski
 * Subject to the GNU Public License, v.2
 *
 * String table for loadable section headers.  See vdso2c.h for why
 * this exists.
 */

const char fake_shstrtab[] __attribute__((section(".fake_shstrtab"))) =
	".hash\0"
	".dynsym\0"
	".dynstr\0"
	".gnu.version\0"
	".gnu.version_d\0"
	".dynamic\0"
	".rodata\0"
	".fake_shstrtab\0"  /* Yay, self-referential code. */
	".note\0"
	".eh_frame_hdr\0"
	".eh_frame\0"
	".text";
+19 −25
Original line number Diff line number Diff line
@@ -18,6 +18,25 @@

SECTIONS
{
	/*
	 * User/kernel shared data is before the vDSO.  This may be a little
	 * uglier than putting it after the vDSO, but it avoids issues with
	 * non-allocatable things that dangle past the end of the PT_LOAD
	 * segment.
	 */

	vvar_start = . - 2 * PAGE_SIZE;
	vvar_page = vvar_start;

	/* Place all vvars at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) vvar_ ## name = vvar_page + offset;
#define __VVAR_KERNEL_LDS
#include <asm/vvar.h>
#undef __VVAR_KERNEL_LDS
#undef EMIT_VVAR

	hpet_page = vvar_start + PAGE_SIZE;

	. = SIZEOF_HEADERS;

	.hash		: { *(.hash) }			:text
@@ -74,31 +93,6 @@ SECTIONS
	.altinstructions	: { *(.altinstructions) }	:text
	.altinstr_replacement	: { *(.altinstr_replacement) }	:text

	/*
	 * The remainder of the vDSO consists of special pages that are
	 * shared between the kernel and userspace.  It needs to be at the
	 * end so that it doesn't overlap the mapping of the actual
	 * vDSO image.
	 */

	. = ALIGN(PAGE_SIZE);
	vvar_page = .;

	/* Place all vvars at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) vvar_ ## name = vvar_page + offset;
#define __VVAR_KERNEL_LDS
#include <asm/vvar.h>
#undef __VVAR_KERNEL_LDS
#undef EMIT_VVAR

	. = vvar_page + PAGE_SIZE;

	hpet_page = .;
	. = . + PAGE_SIZE;

	. = ALIGN(PAGE_SIZE);
	end_mapping = .;

	/DISCARD/ : {
		*(.discard)
		*(.discard.*)
Loading