Commit 779df224 authored by Sven Schnelle's avatar Sven Schnelle Committed by Vasily Gorbik
Browse files

s390/vdso: add minimal compat vdso



Add a small vdso for 31 bit compat application that provides
trampolines for calls to sigreturn,rt_sigreturn,syscall_restart.
This is requird for moving these syscalls away from the signal
frame to the vdso. Note that this patch effectively disables
CONFIG_COMPAT when using clang to compile the kernel. clang
doesn't support 31 bit mode.

We want to redirect sigreturn and restart_syscall to the vdso. However,
the kernel cannot parse the ELF vdso file, so we need to generate header
files which contain the offsets of the syscall instructions in the vdso
page.

Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 43e1f76b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -437,6 +437,7 @@ config COMPAT
	select COMPAT_OLD_SIGACTION
	select HAVE_UID16
	depends on MULTIUSER
	depends on !CC_IS_CLANG
	help
	  Select this option if you want to enable your system kernel to
	  handle system-calls from ELF binaries for 31 bit ESA.  This option
+13 −0
Original line number Diff line number Diff line
@@ -166,6 +166,19 @@ archheaders:
archprepare:
	$(Q)$(MAKE) $(build)=$(syscalls) kapi
	$(Q)$(MAKE) $(build)=$(tools) kapi
ifeq ($(KBUILD_EXTMOD),)
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
# In order to do that, we should use the archprepare target, but we can't since
# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
# Therefore we need to generate the header after prepare0 has been made, hence
# this hack.
prepare: vdso_prepare
vdso_prepare: prepare0
	$(Q)$(MAKE) $(build)=arch/s390/kernel/vdso64 include/generated/vdso64-offsets.h
	$(if $(CONFIG_COMPAT),$(Q)$(MAKE) \
		$(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h)
endif

# Don't use tabs in echo arguments
define archhelp
+0 −2
Original line number Diff line number Diff line
@@ -144,8 +144,6 @@ typedef s390_compat_regs compat_elf_gregset_t;
#include <linux/sched/mm.h>	/* for task_struct */
#include <asm/mmu_context.h>

#include <asm/vdso.h>

/*
 * This is used to ensure we don't load something for the wrong architecture.
 */
+19 −6
Original line number Diff line number Diff line
@@ -4,18 +4,31 @@

#include <vdso/datapage.h>

/* Default link address for the vDSO */
#define VDSO_LBASE	0

#define __VVAR_PAGES	2
#ifndef __ASSEMBLY__

#define VDSO_VERSION_STRING	LINUX_2.6.29
#include <generated/vdso64-offsets.h>
#ifdef CONFIG_COMPAT
#include <generated/vdso32-offsets.h>
#endif

#ifndef __ASSEMBLY__
#define VDSO64_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso64_offset_##name))
#ifdef CONFIG_COMPAT
#define VDSO32_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso32_offset_##name))
#else
#define VDSO32_SYMBOL(tsk, name) (-1UL)
#endif

extern struct vdso_data *vdso_data;

int vdso_getcpu_init(void);

#endif /* __ASSEMBLY__ */

/* Default link address for the vDSO */
#define VDSO_LBASE	0

#define __VVAR_PAGES	2

#define VDSO_VERSION_STRING	LINUX_2.6.29

#endif /* __S390_VDSO_H__ */
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@

#include <asm/timex.h>
#include <asm/unistd.h>
#include <asm/vdso.h>
#include <linux/compiler.h>

#define vdso_calc_delta __arch_vdso_calc_delta
Loading