diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index eb7035720624..867085add60c 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -343,6 +343,7 @@ class Gencontrol(Base): ('kernel-arch', 'KERNEL_ARCH', False), ('cflags', 'KCFLAGS', True), ('override-host-type', 'OVERRIDE_HOST_TYPE', True), + ('cross-compile-compat', 'CROSS_COMPILE_COMPAT', True), ) flavour_makeflags_build = ( diff --git a/debian/changelog b/debian/changelog index 9d89fd90f291..32ad53a14c07 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,14 @@ linux (5.3.7-2) UNRELEASED; urgency=medium * debian/templates/headers.postinst.in: Set executable for consistency * debian/README.source: Document code signing and how to test it * debian/tests/control: Mark python test as superficial + * [arm64] linux-headers: Disable check for a 32-bit compiler + (Closes: #943953): + - arm64: vdso32: Fix broken compat vDSO build warnings + - arm64: Kconfig: Make CONFIG_COMPAT_VDSO a proper Kconfig option + - debian/bin/gencontrol.py: Optionally define $(CROSS_COMPILE_COMPAT) make + variable + - Enable COMPAT_VDSO and set $(CROSS_COMPILE_COMPAT) instead of setting + CROSS_COMPILE_COMPAT_VDSO [ Bastian Blank ] * [amd64/cloud-amd64] Re-enable RTC drivers. (closes: #931341) diff --git a/debian/config/arm64/config b/debian/config/arm64/config index 6ee6e2f0179f..2a151425197e 100644 --- a/debian/config/arm64/config +++ b/debian/config/arm64/config @@ -15,6 +15,7 @@ CONFIG_KEXEC=y CONFIG_CRASH_DUMP=y CONFIG_XEN=y CONFIG_COMPAT=y +CONFIG_COMPAT_VDSO=y CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y @@ -1281,11 +1282,6 @@ CONFIG_CMA_SIZE_MBYTES=64 ## CONFIG_ENERGY_MODEL=y -## -## file: lib/vdso/Kconfig -## -CONFIG_CROSS_COMPILE_COMPAT_VDSO="arm-linux-gnueabihf-" - ## ## file: mm/Kconfig ## diff --git a/debian/config/arm64/defines b/debian/config/arm64/defines index 49dff387068c..3d1173101080 100644 --- a/debian/config/arm64/defines +++ b/debian/config/arm64/defines @@ -1,4 +1,5 @@ [base] +cross-compile-compat: arm-linux-gnueabihf- kernel-arch: arm64 featuresets: none diff --git a/debian/patches/bugfix/arm64/arm64-kconfig-make-config_compat_vdso-a-proper-kconf.patch b/debian/patches/bugfix/arm64/arm64-kconfig-make-config_compat_vdso-a-proper-kconf.patch new file mode 100644 index 000000000000..e34b6e54877b --- /dev/null +++ b/debian/patches/bugfix/arm64/arm64-kconfig-make-config_compat_vdso-a-proper-kconf.patch @@ -0,0 +1,71 @@ +From: Will Deacon +Date: Mon, 7 Oct 2019 13:03:12 +0100 +Subject: arm64: Kconfig: Make CONFIG_COMPAT_VDSO a proper Kconfig option +Origin: https://git.kernel.org/linus/7c4791c9efca8c105a86022f7d5532aeaa819125 +Bug-Debian: https://bugs.debian.org/943953 + +CONFIG_COMPAT_VDSO is defined by passing '-DCONFIG_COMPAT_VDSO' to the +compiler when the generic compat vDSO code is in use. It's much cleaner +and simpler to expose this as a proper Kconfig option (like x86 does), +so do that and remove the bodge. + +Acked-by: Catalin Marinas +Signed-off-by: Will Deacon +[bwh: Backported to 5.3: adjust context] +--- + arch/arm64/Kconfig | 15 +++++++++++++-- + arch/arm64/Makefile | 5 ----- + 2 files changed, 13 insertions(+), 7 deletions(-) + +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -111,7 +111,6 @@ config ARM64 + select GENERIC_STRNLEN_USER + select GENERIC_TIME_VSYSCALL + select GENERIC_GETTIMEOFDAY +- select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT && "$(CROSS_COMPILE_COMPAT)" != "") + select HANDLE_DOMAIN_IRQ + select HARDIRQS_SW_RESEND + select HAVE_PCI +@@ -1132,7 +1131,7 @@ menuconfig COMPAT + if COMPAT + + config KUSER_HELPERS +- bool "Enable kuser helpers page for 32 bit applications" ++ bool "Enable kuser helpers page for 32-bit applications" + default y + help + Warning: disabling this option may break 32-bit user programs. +@@ -1158,6 +1157,18 @@ config KUSER_HELPERS + Say N here only if you are absolutely certain that you do not + need these helpers; otherwise, the safe option is to say Y. + ++config COMPAT_VDSO ++ bool "Enable vDSO for 32-bit applications" ++ depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != "" ++ select GENERIC_COMPAT_VDSO ++ default y ++ help ++ Place in the process address space of 32-bit applications an ++ ELF shared object providing fast implementations of gettimeofday ++ and clock_gettime. ++ ++ You must have a 32-bit build of glibc 2.22 or later for programs ++ to seamlessly take advantage of this. + + menuconfig ARMV8_DEPRECATED + bool "Emulate deprecated/obsolete ARMv8 instructions" +--- a/arch/arm64/Makefile ++++ b/arch/arm64/Makefile +@@ -50,11 +50,6 @@ endif + COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc + export COMPATCC + +-ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y) +- export CONFIG_COMPAT_VDSO := y +- compat_vdso := -DCONFIG_COMPAT_VDSO=1 +-endif +- + KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) $(compat_vdso) + KBUILD_CFLAGS += -fno-asynchronous-unwind-tables + KBUILD_CFLAGS += $(call cc-disable-warning, psabi) diff --git a/debian/patches/bugfix/arm64/arm64-vdso32-fix-broken-compat-vdso-build-warnings.patch b/debian/patches/bugfix/arm64/arm64-vdso32-fix-broken-compat-vdso-build-warnings.patch new file mode 100644 index 000000000000..1c16b53184da --- /dev/null +++ b/debian/patches/bugfix/arm64/arm64-vdso32-fix-broken-compat-vdso-build-warnings.patch @@ -0,0 +1,98 @@ +From: Vincenzo Frascino +Date: Thu, 3 Oct 2019 18:48:33 +0100 +Subject: arm64: vdso32: Fix broken compat vDSO build warnings +Origin: https://git.kernel.org/linus/e0de01aafc3dd7b73308106b056ead2d48391905 +Bug-Debian: https://bugs.debian.org/943953 + +The .config file and the generated include/config/auto.conf can +end up out of sync after a set of commands since +CONFIG_CROSS_COMPILE_COMPAT_VDSO is not updated correctly. + +The sequence can be reproduced as follows: + +$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig +[...] +$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig +[set CONFIG_CROSS_COMPILE_COMPAT_VDSO="arm-linux-gnueabihf-"] +$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- + +Which results in: + +arch/arm64/Makefile:62: CROSS_COMPILE_COMPAT not defined or empty, +the compat vDSO will not be built + +even though the compat vDSO has been built: + +$ file arch/arm64/kernel/vdso32/vdso.so +arch/arm64/kernel/vdso32/vdso.so: ELF 32-bit LSB pie executable, ARM, +EABI5 version 1 (SYSV), dynamically linked, +BuildID[sha1]=c67f6c786f2d2d6f86c71f708595594aa25247f6, stripped + +A similar case that involves changing the configuration parameter +multiple times can be reconducted to the same family of problems. + +Remove the use of CONFIG_CROSS_COMPILE_COMPAT_VDSO altogether and +instead rely on the cross-compiler prefix coming from the environment +via CROSS_COMPILE_COMPAT, much like we do for the rest of the kernel. + +Cc: Will Deacon +Cc: Catalin Marinas +Reported-by: Will Deacon +Signed-off-by: Vincenzo Frascino +Signed-off-by: Will Deacon +--- + arch/arm64/Kconfig | 2 +- + arch/arm64/Makefile | 18 +++++------------- + arch/arm64/kernel/vdso32/Makefile | 2 -- + 3 files changed, 6 insertions(+), 16 deletions(-) + +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -111,7 +111,7 @@ config ARM64 + select GENERIC_STRNLEN_USER + select GENERIC_TIME_VSYSCALL + select GENERIC_GETTIMEOFDAY +- select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT) ++ select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT && "$(CROSS_COMPILE_COMPAT)" != "") + select HANDLE_DOMAIN_IRQ + select HARDIRQS_SW_RESEND + select HAVE_PCI +--- a/arch/arm64/Makefile ++++ b/arch/arm64/Makefile +@@ -47,20 +47,12 @@ $(warning Detected assembler with broken + endif + endif + +-ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y) +- CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%) ++COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc ++export COMPATCC + +- ifeq ($(CONFIG_CC_IS_CLANG), y) +- $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built) +- else ifeq ($(strip $(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 ++ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y) ++ export CONFIG_COMPAT_VDSO := y ++ compat_vdso := -DCONFIG_COMPAT_VDSO=1 + endif + + KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) $(compat_vdso) +--- a/arch/arm64/kernel/vdso32/Makefile ++++ b/arch/arm64/kernel/vdso32/Makefile +@@ -8,8 +8,6 @@ + ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32 + include $(srctree)/lib/vdso/Makefile + +-COMPATCC := $(CROSS_COMPILE_COMPAT)gcc +- + # Same as cc-*option, but using COMPATCC instead of CC + cc32-option = $(call try-run,\ + $(COMPATCC) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) diff --git a/debian/patches/series b/debian/patches/series index cbdb06daf479..c71044f8bba3 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -73,6 +73,8 @@ bugfix/arm64/arm64-acpi-Add-fixup-for-HPE-m400-quirks.patch bugfix/x86/x86-32-disable-3dnow-in-generic-config.patch bugfix/riscv64/riscv-Fix-memblock-reservation-for-device-tree-blob.patch bugfix/riscv64/RISC-V-Clear-load-reservations-while-restoring-hart-.patch +bugfix/arm64/arm64-vdso32-fix-broken-compat-vdso-build-warnings.patch +bugfix/arm64/arm64-kconfig-make-config_compat_vdso-a-proper-kconf.patch # Arch features features/mips/MIPS-Loongson-3-Add-Loongson-LS3A-RS780E-1-way-machi.patch