From: Sasha Levin Date: Wed, 14 Oct 2020 14:19:52 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v5.9.1~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=99e19601503f0694e166d34ead416dae90d15385;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/arm-8858-1-vdso-use-ld-instead-of-cc-to-link-vdso.patch b/queue-4.19/arm-8858-1-vdso-use-ld-instead-of-cc-to-link-vdso.patch new file mode 100644 index 00000000000..6900d70a254 --- /dev/null +++ b/queue-4.19/arm-8858-1-vdso-use-ld-instead-of-cc-to-link-vdso.patch @@ -0,0 +1,82 @@ +From d9de5372e8e1c28c95e8272b3c551d36afeb6f61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Apr 2019 10:57:49 +0100 +Subject: ARM: 8858/1: vdso: use $(LD) instead of $(CC) to link VDSO + +From: Masahiro Yamada + +[ Upstream commit fe00e50b2db8c60e4ec90befad1f5bab8ca2c800 ] + +We use $(LD) to link vmlinux, modules, decompressors, etc. + +VDSO is the only exceptional case where $(CC) is used as the linker +driver, but I do not know why we need to do so. VDSO uses a special +linker script, and does not link standard libraries at all. + +I changed the Makefile to use $(LD) rather than $(CC). I confirmed +the same vdso.so.raw was still produced. + +Users will be able to use their favorite linker (e.g. lld instead of +of bfd) by passing LD= from the command line. + +My plan is to rewrite all VDSO Makefiles to use $(LD), then delete + +cc-ldoption. + +Signed-off-by: Masahiro Yamada +Reviewed-by: Nick Desaulniers +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + arch/arm/vdso/Makefile | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile +index f4efff9d3afbb..fadf554d93917 100644 +--- a/arch/arm/vdso/Makefile ++++ b/arch/arm/vdso/Makefile +@@ -10,12 +10,12 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) + ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector + ccflags-y += -DDISABLE_BRANCH_PROFILING + +-VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 +-VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 +-VDSO_LDFLAGS += -nostdlib -shared +-VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) +-VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id) +-VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd) ++ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \ ++ -z max-page-size=4096 -z common-page-size=4096 \ ++ -nostdlib -shared \ ++ $(call ld-option, --hash-style=sysv) \ ++ $(call ld-option, --build-id) \ ++ -T + + obj-$(CONFIG_VDSO) += vdso.o + extra-$(CONFIG_VDSO) += vdso.lds +@@ -37,8 +37,8 @@ KCOV_INSTRUMENT := n + $(obj)/vdso.o : $(obj)/vdso.so + + # Link rule for the .so file +-$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE +- $(call if_changed,vdsold) ++$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE ++ $(call if_changed,ld) + + $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE + $(call if_changed,vdsomunge) +@@ -48,11 +48,6 @@ $(obj)/%.so: OBJCOPYFLAGS := -S + $(obj)/%.so: $(obj)/%.so.dbg FORCE + $(call if_changed,objcopy) + +-# Actual build commands +-quiet_cmd_vdsold = VDSO $@ +- cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ +- -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@ +- + quiet_cmd_vdsomunge = MUNGE $@ + cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@ + +-- +2.25.1 + diff --git a/queue-4.19/arm-8867-1-vdso-pass-be8-to-linker-if-necessary.patch b/queue-4.19/arm-8867-1-vdso-pass-be8-to-linker-if-necessary.patch new file mode 100644 index 00000000000..f413c444a9d --- /dev/null +++ b/queue-4.19/arm-8867-1-vdso-pass-be8-to-linker-if-necessary.patch @@ -0,0 +1,48 @@ +From 8ecee16045dbc1af009857c972b3471dce0d2a13 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jun 2019 13:29:19 +0100 +Subject: ARM: 8867/1: vdso: pass --be8 to linker if necessary + +From: Jason A. Donenfeld + +[ Upstream commit c5d0e49e8d8f1a23034fdf8e935afc0c8f7ae27d ] + +The commit fe00e50b2db8 ("ARM: 8858/1: vdso: use $(LD) instead of $(CC) +to link VDSO") removed the passing of CFLAGS, since ld doesn't take +those directly. However, prior, big-endian ARM was relying on gcc to +translate its -mbe8 option into ld's --be8 option. Lacking this, ld +generated be32 code, making the VDSO generate SIGILL when called by +userspace. + +This commit passes --be8 if CONFIG_CPU_ENDIAN_BE8 is enabled. + +Signed-off-by: Jason A. Donenfeld +Cc: Masahiro Yamada +Cc: Arnd Bergmann +Cc: Ard Biesheuvel +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + arch/arm/vdso/Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile +index fadf554d93917..1f5ec9741e6d4 100644 +--- a/arch/arm/vdso/Makefile ++++ b/arch/arm/vdso/Makefile +@@ -10,9 +10,10 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) + ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector + ccflags-y += -DDISABLE_BRANCH_PROFILING + +-ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \ ++ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8 ++ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \ + -z max-page-size=4096 -z common-page-size=4096 \ +- -nostdlib -shared \ ++ -nostdlib -shared $(ldflags-y) \ + $(call ld-option, --hash-style=sysv) \ + $(call ld-option, --build-id) \ + -T +-- +2.25.1 + diff --git a/queue-4.19/arm-8939-1-kbuild-use-correct-nm-executable.patch b/queue-4.19/arm-8939-1-kbuild-use-correct-nm-executable.patch new file mode 100644 index 00000000000..05987c841f6 --- /dev/null +++ b/queue-4.19/arm-8939-1-kbuild-use-correct-nm-executable.patch @@ -0,0 +1,54 @@ +From 2538ffd3e39a6987cd9d796f49c3d83f752e30b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Nov 2019 16:39:42 +0100 +Subject: ARM: 8939/1: kbuild: use correct nm executable + +From: Dmitry Golovin + +[ Upstream commit 29c623d64f0dcd6aa10e0eabd16233e77114090b ] + +Since $(NM) variable can be easily overridden for the whole build, it's +better to use it instead of $(CROSS_COMPILE)nm. The use of $(CROSS_COMPILE) +prefixed variables where their calculated equivalents can be used is +incorrect. This fixes issues with builds where $(NM) is set to llvm-nm. + +Link: https://github.com/ClangBuiltLinux/linux/issues/766 + +Signed-off-by: Dmitry Golovin +Suggested-by: Nick Desaulniers +Cc: Matthias Maennich +Reviewed-by: Nathan Chancellor +Tested-by: Nathan Chancellor +Reviewed-by: Masahiro Yamada +Reviewed-by: Nick Desaulniers +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + arch/arm/boot/compressed/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile +index 1f5a5ffe7fcf8..c762004572eff 100644 +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -120,7 +120,7 @@ ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin -I$(obj) + asflags-y := -DZIMAGE + + # Supply kernel BSS size to the decompressor via a linker symbol. +-KBSS_SZ = $(shell echo $$(($$($(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ ++KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \ + sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \ + -e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) ) + LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ) +@@ -166,7 +166,7 @@ $(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S + # The .data section is already discarded by the linker script so no need + # to bother about it here. + check_for_bad_syms = \ +-bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ ++bad_syms=$$($(NM) $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ + [ -z "$$bad_syms" ] || \ + ( echo "following symbols must have non local/private scope:" >&2; \ + echo "$$bad_syms" >&2; rm -f $@; false ) +-- +2.25.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 027db12913c..d148f17f455 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -1 +1,4 @@ perf-cs-etm-move-definition-of-traceid_list-global-variable-from-header-file.patch +arm-8858-1-vdso-use-ld-instead-of-cc-to-link-vdso.patch +arm-8939-1-kbuild-use-correct-nm-executable.patch +arm-8867-1-vdso-pass-be8-to-linker-if-necessary.patch