]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Wed, 14 Oct 2020 14:19:52 +0000 (10:19 -0400)
committerSasha Levin <sashal@kernel.org>
Wed, 14 Oct 2020 14:20:46 +0000 (10:20 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/arm-8858-1-vdso-use-ld-instead-of-cc-to-link-vdso.patch [new file with mode: 0644]
queue-4.19/arm-8867-1-vdso-pass-be8-to-linker-if-necessary.patch [new file with mode: 0644]
queue-4.19/arm-8939-1-kbuild-use-correct-nm-executable.patch [new file with mode: 0644]
queue-4.19/series

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 (file)
index 0000000..6900d70
--- /dev/null
@@ -0,0 +1,82 @@
+From d9de5372e8e1c28c95e8272b3c551d36afeb6f61 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+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 <yamada.masahiro@socionext.com>
+
+[ 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 <yamada.masahiro@socionext.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..f413c44
--- /dev/null
@@ -0,0 +1,48 @@
+From 8ecee16045dbc1af009857c972b3471dce0d2a13 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Jun 2019 13:29:19 +0100
+Subject: ARM: 8867/1: vdso: pass --be8 to linker if necessary
+
+From: Jason A. Donenfeld <Jason@zx2c4.com>
+
+[ 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 <Jason@zx2c4.com>
+Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..05987c8
--- /dev/null
@@ -0,0 +1,54 @@
+From 2538ffd3e39a6987cd9d796f49c3d83f752e30b7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Nov 2019 16:39:42 +0100
+Subject: ARM: 8939/1: kbuild: use correct nm executable
+
+From: Dmitry Golovin <dima@golovin.in>
+
+[ 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 <dima@golovin.in>
+Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
+Cc: Matthias Maennich <maennich@google.com>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Tested-by: Nathan Chancellor <natechancellor@gmail.com>
+Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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
+
index 027db12913c44cd191ecf76eb2f8fd7e4023d21a..d148f17f455592748291b325fd0ecede58cee3e8 100644 (file)
@@ -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