Message ID | 20190530141531.43462-16-vincenzo.frascino@arm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Unify vDSOs across more architectures | expand |
On Thu, May 30, 2019 at 03:15:27PM +0100, Vincenzo Frascino wrote: > Add vDSO compat support to the arm64 building system. > > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will.deacon@arm.com> > Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> > --- > arch/arm64/Kconfig | 1 + > arch/arm64/Makefile | 23 +++++++++++++++++++++-- > arch/arm64/kernel/Makefile | 6 +++++- > 3 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 952c9f8cf3b8..3e1d4f8347f4 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -108,6 +108,7 @@ config ARM64 > select GENERIC_STRNLEN_USER > select GENERIC_TIME_VSYSCALL > select GENERIC_GETTIMEOFDAY > + select GENERIC_COMPAT_VDSO if !CPU_BIG_ENDIAN This select needs to also depend on COMPAT (or rather be selected from the COMPAT menuconfig), otherwise, trying to build this series with 64K pages where COMPAT is disabled, I get: VDSOC_GTD arch/arm64/kernel/vdso32/vgettimeofday.o VDSOA arch/arm64/kernel/vdso32/sigreturn.o arch/arm64/kernel/vdso32/sigreturn.S: Assembler messages: arch/arm64/kernel/vdso32/sigreturn.S:25: Error: expected #constant arch/arm64/kernel/vdso32/sigreturn.S:35: Error: expected #constant arch/arm64/kernel/vdso32/sigreturn.S:46: Error: expected #constant arch/arm64/kernel/vdso32/sigreturn.S:56: Error: expected #constant arch/arm64/kernel/vdso32/sigreturn.S:28: Error: undefined symbol __NR_compat_sigreturn used as an immediate value arch/arm64/kernel/vdso32/sigreturn.S:38: Error: undefined symbol __NR_compat_rt_sigreturn used as an immediate value make[2]: *** [arch/arm64/kernel/vdso32/Makefile:154: arch/arm64/kernel/vdso32/sigreturn.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from lib/vdso/gettimeofday.c:25:0, from <command-line>:0: arch/arm64/include/asm/vdso/compat_gettimeofday.h: In function 'gettimeofday_fallback': arch/arm64/include/asm/vdso/compat_gettimeofday.h:22:31: error: '__NR_compat_gettimeofday' undeclared (first use in this function); did you mean '__NR_gettimeofday'? register long nr asm("r7") = __NR_compat_gettimeofday; ^~~~~~~~~~~~~~~~~~~~~~~~ __NR_gettimeofday arch/arm64/include/asm/vdso/compat_gettimeofday.h:22:31: note: each undeclared identifier is reported only once for each function it appears in arch/arm64/include/asm/vdso/compat_gettimeofday.h: In function 'clock_gettime_fallback': arch/arm64/include/asm/vdso/compat_gettimeofday.h:40:31: error: '__NR_compat_clock_gettime64' undeclared (first use in this function); did you mean '__NR_clock_gettime'? register long nr asm("r7") = __NR_compat_clock_gettime64; ^~~~~~~~~~~~~~~~~~~~~~~~~~~ __NR_clock_gettime arch/arm64/include/asm/vdso/compat_gettimeofday.h: In function 'clock_getres_fallback': arch/arm64/include/asm/vdso/compat_gettimeofday.h:58:31: error: '__NR_compat_clock_getres_time64' undeclared (first use in this function); did you mean '__NR_clock_gettime'? register long nr asm("r7") = __NR_compat_clock_getres_time64; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __NR_clock_gettime arch/arm64/kernel/vdso32/vgettimeofday.c: In function '__vdso_clock_gettime': arch/arm64/kernel/vdso32/vgettimeofday.c:15:17: error: 'TASK_SIZE_32' undeclared (first use in this function); did you mean 'TASK_SIZE_64'? if ((u32)ts >= TASK_SIZE_32) ^~~~~~~~~~~~ TASK_SIZE_64 arch/arm64/kernel/vdso32/vgettimeofday.c: In function '__vdso_clock_gettime64': arch/arm64/kernel/vdso32/vgettimeofday.c:25:17: error: 'TASK_SIZE_32' undeclared (first use in this function); did you mean 'TASK_SIZE_64'? if ((u32)ts >= TASK_SIZE_32) ^~~~~~~~~~~~ TASK_SIZE_64 arch/arm64/kernel/vdso32/vgettimeofday.c: In function '__vdso_clock_getres': arch/arm64/kernel/vdso32/vgettimeofday.c:41:18: error: 'TASK_SIZE_32' undeclared (first use in this function); did you mean 'TASK_SIZE_64'? if ((u32)res >= TASK_SIZE_32) ^~~~~~~~~~~~ TASK_SIZE_64 make[2]: *** [arch/arm64/kernel/vdso32/Makefile:152: arch/arm64/kernel/vdso32/vgettimeofday.o] Error 1 make[1]: *** [arch/arm64/Makefile:182: vdso_prepare] Error 2 make: *** [Makefile:179: sub-make] Error 2
Hi Catalin, thank you for testing my patches and providing the scripts you used to reproduce the issue. On 01/06/2019 10:38, Catalin Marinas wrote: > On Thu, May 30, 2019 at 03:15:27PM +0100, Vincenzo Frascino wrote: >> Add vDSO compat support to the arm64 building system. >> >> Cc: Catalin Marinas <catalin.marinas@arm.com> >> Cc: Will Deacon <will.deacon@arm.com> >> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> >> --- >> arch/arm64/Kconfig | 1 + >> arch/arm64/Makefile | 23 +++++++++++++++++++++-- >> arch/arm64/kernel/Makefile | 6 +++++- >> 3 files changed, 27 insertions(+), 3 deletions(-) >> >> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig >> index 952c9f8cf3b8..3e1d4f8347f4 100644 >> --- a/arch/arm64/Kconfig >> +++ b/arch/arm64/Kconfig >> @@ -108,6 +108,7 @@ config ARM64 >> select GENERIC_STRNLEN_USER >> select GENERIC_TIME_VSYSCALL >> select GENERIC_GETTIMEOFDAY >> + select GENERIC_COMPAT_VDSO if !CPU_BIG_ENDIAN > > This select needs to also depend on COMPAT (or rather be selected from > the COMPAT menuconfig), otherwise, trying to build this series with 64K > pages where COMPAT is disabled, I get: > This is a very good catch, my bad, will definitely fix in v7. ...
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 952c9f8cf3b8..3e1d4f8347f4 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -108,6 +108,7 @@ config ARM64 select GENERIC_STRNLEN_USER select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY + select GENERIC_COMPAT_VDSO if !CPU_BIG_ENDIAN select HANDLE_DOMAIN_IRQ select HARDIRQS_SW_RESEND select HAVE_PCI diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index b025304bde46..4db50d4b2476 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -49,9 +49,25 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable) endif endif -KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) +ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y) + CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%) + + ifeq ($(CONFIG_CC_IS_CLANG), y) + $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built) + else ifeq ($(CROSS_COMPILE_COMPAT),) + $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built) + else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),) + $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT) + else + export CROSS_COMPILE_COMPAT + export CONFIG_COMPAT_VDSO := y + compat_vdso := -DCONFIG_COMPAT_VDSO=1 + endif +endif + +KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) $(compat_vdso) KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) +KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) $(compat_vdso) KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) @@ -163,6 +179,9 @@ ifeq ($(KBUILD_EXTMOD),) prepare: vdso_prepare vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h + $(if $(CONFIG_COMPAT_VDSO),$(Q)$(MAKE) \ + $(build)=arch/arm64/kernel/vdso32 \ + include/generated/vdso32-offsets.h) endif define archhelp diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 9e7dcb2c31c7..478491f07b4f 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -28,7 +28,10 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE $(call if_changed,objcopy) obj-$(CONFIG_COMPAT) += sys32.o signal32.o \ - sigreturn32.o sys_compat.o + sys_compat.o +ifneq ($(CONFIG_COMPAT_VDSO), y) +obj-$(CONFIG_COMPAT) += sigreturn32.o +endif obj-$(CONFIG_KUSER_HELPERS) += kuser32.o obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o obj-$(CONFIG_MODULES) += module.o @@ -62,6 +65,7 @@ obj-$(CONFIG_ARM64_SSBD) += ssbd.o obj-$(CONFIG_ARM64_PTR_AUTH) += pointer_auth.o obj-y += vdso/ probes/ +obj-$(CONFIG_COMPAT_VDSO) += vdso32/ head-y := head.o extra-y += $(head-y) vmlinux.lds
Add vDSO compat support to the arm64 building system. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> --- arch/arm64/Kconfig | 1 + arch/arm64/Makefile | 23 +++++++++++++++++++++-- arch/arm64/kernel/Makefile | 6 +++++- 3 files changed, 27 insertions(+), 3 deletions(-)