]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Tue, 14 May 2019 18:25:04 +0000 (14:25 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 14 May 2019 18:49:38 +0000 (14:49 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/revert-x86-vdso-drop-implicit-common-page-size-linke.patch [new file with mode: 0644]
queue-4.9/revert-x86-vdso-use-ld-instead-of-cc-to-link.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/x86-vdso-drop-implicit-common-page-size-linker-flag.patch [new file with mode: 0644]
queue-4.9/x86-vdso-use-ld-instead-of-cc-to-link.patch-23362 [new file with mode: 0644]

diff --git a/queue-4.9/revert-x86-vdso-drop-implicit-common-page-size-linke.patch b/queue-4.9/revert-x86-vdso-drop-implicit-common-page-size-linke.patch
new file mode 100644 (file)
index 0000000..2ad078d
--- /dev/null
@@ -0,0 +1,40 @@
+From 9c28ba88a67d922b065f2ff1b1ed7e323bbe18b7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 May 2019 14:18:47 -0400
+Subject: Revert "x86/vdso: Drop implicit common-page-size linker flag"
+
+This reverts commit 408d67a0fecf4cfe7869f518211ae278ee44376e.
+
+The commit message in the 4.9 stable tree did not have a reference to
+the upstream commit id.
+
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/entry/vdso/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
+index 0d3ebdfa07396..cec8cb28eabae 100644
+--- a/arch/x86/entry/vdso/Makefile
++++ b/arch/x86/entry/vdso/Makefile
+@@ -48,7 +48,7 @@ targets += $(vdso_img_sodbg)
+ export CPPFLAGS_vdso.lds += -P -C
+ VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
+-                      -z max-page-size=4096
++                      -z max-page-size=4096 -z common-page-size=4096
+ $(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
+       $(call if_changed,vdso)
+@@ -95,7 +95,7 @@ CFLAGS_REMOVE_vvar.o = -pg
+ CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
+ VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
+-                         -z max-page-size=4096
++                         -z max-page-size=4096 -z common-page-size=4096
+ # 64-bit objects to re-brand as x32
+ vobjs64-for-x32 := $(filter-out $(vobjs-nox32),$(vobjs-y))
+-- 
+2.20.1
+
diff --git a/queue-4.9/revert-x86-vdso-use-ld-instead-of-cc-to-link.patch b/queue-4.9/revert-x86-vdso-use-ld-instead-of-cc-to-link.patch
new file mode 100644 (file)
index 0000000..0370299
--- /dev/null
@@ -0,0 +1,75 @@
+From 00bdbe4f9d2427a1102b175fb52e80ff995eaf33 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 May 2019 14:20:34 -0400
+Subject: Revert "x86: vdso: Use $LD instead of $CC to link"
+
+This reverts commit 94c0c4f033eee2304a98cf30a141f9dae35d3a62.
+
+The commit message in the 4.9 stable tree did not have a reference to
+the upstream commit id.
+
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/entry/vdso/Makefile | 22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
+
+diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
+index 2ae92c6b1de6d..d5409660f5de6 100644
+--- a/arch/x86/entry/vdso/Makefile
++++ b/arch/x86/entry/vdso/Makefile
+@@ -47,8 +47,10 @@ targets += $(vdso_img_sodbg)
+ export CPPFLAGS_vdso.lds += -P -C
+-VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
+-                      -z max-page-size=4096 -z common-page-size=4096
++VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
++                      -Wl,--no-undefined \
++                      -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 \
++                      $(DISABLE_LTO)
+ $(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
+       $(call if_changed,vdso)
+@@ -94,8 +96,10 @@ CFLAGS_REMOVE_vvar.o = -pg
+ #
+ CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
+-VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
+-                         -z max-page-size=4096 -z common-page-size=4096
++VDSO_LDFLAGS_vdsox32.lds = -Wl,-m,elf32_x86_64 \
++                         -Wl,-soname=linux-vdso.so.1 \
++                         -Wl,-z,max-page-size=4096 \
++                         -Wl,-z,common-page-size=4096
+ # 64-bit objects to re-brand as x32
+ vobjs64-for-x32 := $(filter-out $(vobjs-nox32),$(vobjs-y))
+@@ -123,7 +127,7 @@ $(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
+       $(call if_changed,vdso)
+ CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
+-VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -soname linux-gate.so.1
++VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1
+ # This makes sure the $(obj) subdirectory exists even though vdso32/
+ # is not a kbuild sub-make subdirectory.
+@@ -161,13 +165,13 @@ $(obj)/vdso32.so.dbg: FORCE \
+ # The DSO images are built using a special linker script.
+ #
+ quiet_cmd_vdso = VDSO    $@
+-      cmd_vdso = $(LD) -nostdlib -o $@ \
++      cmd_vdso = $(CC) -nostdlib -o $@ \
+                      $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
+-                     -T $(filter %.lds,$^) $(filter %.o,$^) && \
++                     -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
+                sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
+-VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \
+-      $(call ld-option, --build-id) -Bsymbolic
++VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \
++      $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
+ GCOV_PROFILE := n
+ #
+-- 
+2.20.1
+
index 3c1e65742fe811bc6efd83ff20f3d46f4439558a..18edea997b780bea02ba8a90398fe949ca4c7a31 100644 (file)
@@ -29,6 +29,10 @@ spi-st-st95hf-nfc-declare-missing-of-table.patch
 input-synaptics-rmi4-fix-possible-double-free.patch
 cw1200-fix-missing-unlock-on-error-in-cw1200_hw_scan.patch
 alsa-pcm-remove-sndrv_pcm_ioctl1_info-internal-command.patch
-x86-vdso-pass-eh-frame-hdr-to-the-linker.patch
 rtlwifi-rtl8723ae-fix-missing-break-in-switch-statement.patch
 don-t-jump-to-compute_result-state-from-check_result-state.patch
+revert-x86-vdso-drop-implicit-common-page-size-linke.patch
+revert-x86-vdso-use-ld-instead-of-cc-to-link.patch
+x86-vdso-use-ld-instead-of-cc-to-link.patch-23362
+x86-vdso-drop-implicit-common-page-size-linker-flag.patch
+x86-vdso-pass-eh-frame-hdr-to-the-linker.patch
diff --git a/queue-4.9/x86-vdso-drop-implicit-common-page-size-linker-flag.patch b/queue-4.9/x86-vdso-drop-implicit-common-page-size-linker-flag.patch
new file mode 100644 (file)
index 0000000..92bf83c
--- /dev/null
@@ -0,0 +1,59 @@
+From 9660799313e4ce001ba1c489a34daa9d409df8ae Mon Sep 17 00:00:00 2001
+From: Nick Desaulniers <ndesaulniers@google.com>
+Date: Thu, 6 Dec 2018 11:12:31 -0800
+Subject: x86/vdso: Drop implicit common-page-size linker flag
+
+commit ac3e233d29f7f77f28243af0132057d378d3ea58 upstream.
+
+GNU linker's -z common-page-size's default value is based on the target
+architecture. arch/x86/entry/vdso/Makefile sets it to the architecture
+default, which is implicit and redundant. Drop it.
+
+Fixes: 2aae950b21e4 ("x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu")
+Reported-by: Dmitry Golovin <dima@golovin.in>
+Reported-by: Bill Wendling <morbo@google.com>
+Suggested-by: Dmitry Golovin <dima@golovin.in>
+Suggested-by: Rui Ueyama <ruiu@google.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Acked-by: Andy Lutomirski <luto@kernel.org>
+Cc: Andi Kleen <andi@firstfloor.org>
+Cc: Fangrui Song <maskray@google.com>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: x86-ml <x86@kernel.org>
+Link: https://lkml.kernel.org/r/20181206191231.192355-1-ndesaulniers@google.com
+Link: https://bugs.llvm.org/show_bug.cgi?id=38774
+Link: https://github.com/ClangBuiltLinux/linux/issues/31
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/entry/vdso/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
+index 2ae92c6b1de6d..756dc9432d152 100644
+--- a/arch/x86/entry/vdso/Makefile
++++ b/arch/x86/entry/vdso/Makefile
+@@ -48,7 +48,7 @@ targets += $(vdso_img_sodbg)
+ export CPPFLAGS_vdso.lds += -P -C
+ VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
+-                      -z max-page-size=4096 -z common-page-size=4096
++                      -z max-page-size=4096
+ $(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
+       $(call if_changed,vdso)
+@@ -95,7 +95,7 @@ CFLAGS_REMOVE_vvar.o = -pg
+ CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
+ VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
+-                         -z max-page-size=4096 -z common-page-size=4096
++                         -z max-page-size=4096
+ # 64-bit objects to re-brand as x32
+ vobjs64-for-x32 := $(filter-out $(vobjs-nox32),$(vobjs-y))
+-- 
+2.20.1
+
diff --git a/queue-4.9/x86-vdso-use-ld-instead-of-cc-to-link.patch-23362 b/queue-4.9/x86-vdso-use-ld-instead-of-cc-to-link.patch-23362
new file mode 100644 (file)
index 0000000..8be0629
--- /dev/null
@@ -0,0 +1,111 @@
+From ed73f65b29894c9d152ffd39538541d53d89abe1 Mon Sep 17 00:00:00 2001
+From: Alistair Strachan <astrachan@google.com>
+Date: Fri, 3 Aug 2018 10:39:31 -0700
+Subject: x86: vdso: Use $LD instead of $CC to link
+
+commit 379d98ddf41344273d9718556f761420f4dc80b3 upstream.
+
+The vdso{32,64}.so can fail to link with CC=clang when clang tries to find
+a suitable GCC toolchain to link these libraries with.
+
+/usr/bin/ld: arch/x86/entry/vdso/vclock_gettime.o:
+  access beyond end of merged section (782)
+
+This happens because the host environment leaked into the cross compiler
+environment due to the way clang searches for suitable GCC toolchains.
+
+Clang is a retargetable compiler, and each invocation of it must provide
+--target=<something> --gcc-toolchain=<something> to allow it to find the
+correct binutils for cross compilation. These flags had been added to
+KBUILD_CFLAGS, but the vdso code uses CC and not KBUILD_CFLAGS (for various
+reasons) which breaks clang's ability to find the correct linker when cross
+compiling.
+
+Most of the time this goes unnoticed because the host linker is new enough
+to work anyway, or is incompatible and skipped, but this cannot be reliably
+assumed.
+
+This change alters the vdso makefile to just use LD directly, which
+bypasses clang and thus the searching problem. The makefile will just use
+${CROSS_COMPILE}ld instead, which is always what we want. This matches the
+method used to link vmlinux.
+
+This drops references to DISABLE_LTO; this option doesn't seem to be set
+anywhere, and not knowing what its possible values are, it's not clear how
+to convert it from CC to LD flag.
+
+Signed-off-by: Alistair Strachan <astrachan@google.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Andy Lutomirski <luto@kernel.org>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: kernel-team@android.com
+Cc: joel@joelfernandes.org
+Cc: Andi Kleen <andi.kleen@intel.com>
+Link: https://lkml.kernel.org/r/20180803173931.117515-1-astrachan@google.com
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/entry/vdso/Makefile | 22 +++++++++-------------
+ 1 file changed, 9 insertions(+), 13 deletions(-)
+
+diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
+index d5409660f5de6..2ae92c6b1de6d 100644
+--- a/arch/x86/entry/vdso/Makefile
++++ b/arch/x86/entry/vdso/Makefile
+@@ -47,10 +47,8 @@ targets += $(vdso_img_sodbg)
+ export CPPFLAGS_vdso.lds += -P -C
+-VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
+-                      -Wl,--no-undefined \
+-                      -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 \
+-                      $(DISABLE_LTO)
++VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
++                      -z max-page-size=4096 -z common-page-size=4096
+ $(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE
+       $(call if_changed,vdso)
+@@ -96,10 +94,8 @@ CFLAGS_REMOVE_vvar.o = -pg
+ #
+ CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
+-VDSO_LDFLAGS_vdsox32.lds = -Wl,-m,elf32_x86_64 \
+-                         -Wl,-soname=linux-vdso.so.1 \
+-                         -Wl,-z,max-page-size=4096 \
+-                         -Wl,-z,common-page-size=4096
++VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
++                         -z max-page-size=4096 -z common-page-size=4096
+ # 64-bit objects to re-brand as x32
+ vobjs64-for-x32 := $(filter-out $(vobjs-nox32),$(vobjs-y))
+@@ -127,7 +123,7 @@ $(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
+       $(call if_changed,vdso)
+ CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
+-VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1
++VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -soname linux-gate.so.1
+ # This makes sure the $(obj) subdirectory exists even though vdso32/
+ # is not a kbuild sub-make subdirectory.
+@@ -165,13 +161,13 @@ $(obj)/vdso32.so.dbg: FORCE \
+ # The DSO images are built using a special linker script.
+ #
+ quiet_cmd_vdso = VDSO    $@
+-      cmd_vdso = $(CC) -nostdlib -o $@ \
++      cmd_vdso = $(LD) -nostdlib -o $@ \
+                      $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
+-                     -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
++                     -T $(filter %.lds,$^) $(filter %.o,$^) && \
+                sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
+-VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \
+-      $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
++VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \
++      $(call ld-option, --build-id) -Bsymbolic
+ GCOV_PROFILE := n
+ #
+-- 
+2.20.1
+