]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jul 2022 09:48:27 +0000 (11:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jul 2022 09:48:27 +0000 (11:48 +0200)
added patches:
kvm-fix-objtool-relocation-warning.patch
objtool-fix-elf_create_undef_symbol-endianness.patch
tools-arch-update-arch-x86-lib-mem-cpy-set-_64.s-copies-used-in-perf-bench-mem-memcpy-again.patch
tools-headers-remove-broken-definition-of-__little_endian.patch

queue-5.10/kvm-fix-objtool-relocation-warning.patch [new file with mode: 0644]
queue-5.10/objtool-fix-elf_create_undef_symbol-endianness.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/tools-arch-update-arch-x86-lib-mem-cpy-set-_64.s-copies-used-in-perf-bench-mem-memcpy-again.patch [new file with mode: 0644]
queue-5.10/tools-headers-remove-broken-definition-of-__little_endian.patch [new file with mode: 0644]

diff --git a/queue-5.10/kvm-fix-objtool-relocation-warning.patch b/queue-5.10/kvm-fix-objtool-relocation-warning.patch
new file mode 100644 (file)
index 0000000..ce87ac3
--- /dev/null
@@ -0,0 +1,61 @@
+From 291073a566b2094c7192872cc0f17ce73d83cb76 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sun, 3 Oct 2021 13:34:19 -0700
+Subject: kvm: fix objtool relocation warning
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 291073a566b2094c7192872cc0f17ce73d83cb76 upstream.
+
+The recent change to make objtool aware of more symbol relocation types
+(commit 24ff65257375: "objtool: Teach get_alt_entry() about more
+relocation types") also added another check, and resulted in this
+objtool warning when building kvm on x86:
+
+    arch/x86/kvm/emulate.o: warning: objtool: __ex_table+0x4: don't know how to handle reloc symbol type: kvm_fastop_exception
+
+The reason seems to be that kvm_fastop_exception() is marked as a global
+symbol, which causes the relocation to ke kept around for objtool.  And
+at the same time, the kvm_fastop_exception definition (which is done as
+an inline asm statement) doesn't actually set the type of the global,
+which then makes objtool unhappy.
+
+The minimal fix is to just not mark kvm_fastop_exception as being a
+global symbol.  It's only used in that one compilation unit anyway, so
+it was always pointless.  That's how all the other local exception table
+labels are done.
+
+I'm not entirely happy about the kinds of games that the kvm code plays
+with doing its own exception handling, and the fact that it confused
+objtool is most definitely a symptom of the code being a bit too subtle
+and ad-hoc.  But at least this trivial one-liner makes objtool no longer
+upset about what is going on.
+
+Fixes: 24ff65257375 ("objtool: Teach get_alt_entry() about more relocation types")
+Link: https://lore.kernel.org/lkml/CAHk-=wiZwq-0LknKhXN4M+T8jbxn_2i9mcKpO+OaBSSq_Eh7tg@mail.gmail.com/
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Sean Christopherson <seanjc@google.com>
+Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
+Cc: Wanpeng Li <wanpengli@tencent.com>
+Cc: Jim Mattson <jmattson@google.com>
+Cc: Joerg Roedel <joro@8bytes.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/emulate.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -452,7 +452,6 @@ static int fastop(struct x86_emulate_ctx
+       ".skip " __stringify(SETCC_ALIGN) " - (.-" #op "), 0xcc \n\t"
+ asm(".pushsection .fixup, \"ax\"\n"
+-    ".global kvm_fastop_exception \n"
+     "kvm_fastop_exception: xor %esi, %esi; " ASM_RET
+     ".popsection");
diff --git a/queue-5.10/objtool-fix-elf_create_undef_symbol-endianness.patch b/queue-5.10/objtool-fix-elf_create_undef_symbol-endianness.patch
new file mode 100644 (file)
index 0000000..ee1fa95
--- /dev/null
@@ -0,0 +1,36 @@
+From 46c7405df7de8deb97229eacebcee96d61415f3f Mon Sep 17 00:00:00 2001
+From: Vasily Gorbik <gor@linux.ibm.com>
+Date: Wed, 12 May 2021 19:42:10 +0200
+Subject: objtool: Fix elf_create_undef_symbol() endianness
+
+From: Vasily Gorbik <gor@linux.ibm.com>
+
+commit 46c7405df7de8deb97229eacebcee96d61415f3f upstream.
+
+Currently x86 cross-compilation fails on big endian system with:
+
+  x86_64-cross-ld: init/main.o: invalid string offset 488112128 >= 6229 for section `.strtab'
+
+Mark new ELF data in elf_create_undef_symbol() as symbol, so that libelf
+does endianness handling correctly.
+
+Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()")
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Link: https://lore.kernel.org/r/patch-1.thread-6c9df9.git-d39264656387.your-ad-here.call-01620841104-ext-2554@work.hours
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/objtool/elf.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/tools/objtool/elf.c
++++ b/tools/objtool/elf.c
+@@ -961,6 +961,7 @@ static int elf_add_string(struct elf *el
+       data->d_buf = str;
+       data->d_size = strlen(str) + 1;
+       data->d_align = 1;
++      data->d_type = ELF_T_SYM;
+       len = strtab->len;
+       strtab->len += data->d_size;
index 06aac5d57cc22e0c548cc230c8dd909659972803..19c99cc70e7f19a2f4ed8d14e85af4bc97ea5686 100644 (file)
@@ -142,3 +142,7 @@ tools-headers-cpufeatures-sync-with-the-kernel-sources.patch
 x86-bugs-remove-apostrophe-typo.patch
 um-add-missing-apply_returns.patch
 x86-use-mindirect-branch-cs-prefix-for-retpoline-builds.patch
+kvm-fix-objtool-relocation-warning.patch
+objtool-fix-elf_create_undef_symbol-endianness.patch
+tools-arch-update-arch-x86-lib-mem-cpy-set-_64.s-copies-used-in-perf-bench-mem-memcpy-again.patch
+tools-headers-remove-broken-definition-of-__little_endian.patch
diff --git a/queue-5.10/tools-arch-update-arch-x86-lib-mem-cpy-set-_64.s-copies-used-in-perf-bench-mem-memcpy-again.patch b/queue-5.10/tools-arch-update-arch-x86-lib-mem-cpy-set-_64.s-copies-used-in-perf-bench-mem-memcpy-again.patch
new file mode 100644 (file)
index 0000000..5324a28
--- /dev/null
@@ -0,0 +1,83 @@
+From fb24e308b6310541e70d11a3f19dc40742974b95 Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Sun, 9 May 2021 10:19:37 -0300
+Subject: tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' - again
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit fb24e308b6310541e70d11a3f19dc40742974b95 upstream.
+
+To bring in the change made in this cset:
+
+ 5e21a3ecad1500e3 ("x86/alternative: Merge include files")
+
+This just silences these perf tools build warnings, no change in the tools:
+
+  Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
+  diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
+  Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
+  diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
+
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Juergen Gross <jgross@suse.com>
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/arch/x86/lib/memcpy_64.S                         | 2 +-
+ tools/arch/x86/lib/memset_64.S                         | 2 +-
+ tools/include/asm/{alternative-asm.h => alternative.h} | 0
+ tools/arch/x86/lib/memcpy_64.S      |    2 +-
+ tools/arch/x86/lib/memset_64.S      |    2 +-
+ tools/include/asm/alternative-asm.h |   10 ----------
+ tools/include/asm/alternative.h     |   10 ++++++++++
+ 4 files changed, 12 insertions(+), 12 deletions(-)
+ rename tools/include/asm/{alternative-asm.h => alternative.h} (100%)
+
+--- a/tools/arch/x86/lib/memcpy_64.S
++++ b/tools/arch/x86/lib/memcpy_64.S
+@@ -4,7 +4,7 @@
+ #include <linux/linkage.h>
+ #include <asm/errno.h>
+ #include <asm/cpufeatures.h>
+-#include <asm/alternative-asm.h>
++#include <asm/alternative.h>
+ #include <asm/export.h>
+ .pushsection .noinstr.text, "ax"
+--- a/tools/arch/x86/lib/memset_64.S
++++ b/tools/arch/x86/lib/memset_64.S
+@@ -3,7 +3,7 @@
+ #include <linux/linkage.h>
+ #include <asm/cpufeatures.h>
+-#include <asm/alternative-asm.h>
++#include <asm/alternative.h>
+ #include <asm/export.h>
+ /*
+--- a/tools/include/asm/alternative-asm.h
++++ /dev/null
+@@ -1,10 +0,0 @@
+-/* SPDX-License-Identifier: GPL-2.0 */
+-#ifndef _TOOLS_ASM_ALTERNATIVE_ASM_H
+-#define _TOOLS_ASM_ALTERNATIVE_ASM_H
+-
+-/* Just disable it so we can build arch/x86/lib/memcpy_64.S for perf bench: */
+-
+-#define altinstruction_entry #
+-#define ALTERNATIVE_2 #
+-
+-#endif
+--- /dev/null
++++ b/tools/include/asm/alternative.h
+@@ -0,0 +1,10 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++#ifndef _TOOLS_ASM_ALTERNATIVE_ASM_H
++#define _TOOLS_ASM_ALTERNATIVE_ASM_H
++
++/* Just disable it so we can build arch/x86/lib/memcpy_64.S for perf bench: */
++
++#define altinstruction_entry #
++#define ALTERNATIVE_2 #
++
++#endif
diff --git a/queue-5.10/tools-headers-remove-broken-definition-of-__little_endian.patch b/queue-5.10/tools-headers-remove-broken-definition-of-__little_endian.patch
new file mode 100644 (file)
index 0000000..48a2856
--- /dev/null
@@ -0,0 +1,51 @@
+From fa2c02e5798c17c89cbb3135940086ebe07e5c9f Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Wed, 14 Jul 2021 14:28:02 -0300
+Subject: tools headers: Remove broken definition of __LITTLE_ENDIAN
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit fa2c02e5798c17c89cbb3135940086ebe07e5c9f upstream.
+
+The linux/kconfig.h file was copied from the kernel but the line where
+with the generated/autoconf.h include from where the CONFIG_ entries
+would come from was deleted, as tools/ build system don't create that
+file, so we ended up always defining just __LITTLE_ENDIAN as
+CONFIG_CPU_BIG_ENDIAN was nowhere to be found.
+
+This in turn ended up breaking the build in some systems where
+__LITTLE_ENDIAN was already defined, such as the androind NDK.
+
+So just ditch that block that depends on the CONFIG_CPU_BIG_ENDIAN
+define.
+
+The kconfig.h file was copied just to get IS_ENABLED() and a
+'make -C tools/all' doesn't breaks with this removal.
+
+Fixes: 93281c4a96572a34 ("x86/insn: Add an insn_decode() API")
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Borislav Petkov <bp@suse.de>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Link: http://lore.kernel.org/lkml/YO8hK7lqJcIWuBzx@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/include/linux/kconfig.h |    6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/tools/include/linux/kconfig.h
++++ b/tools/include/linux/kconfig.h
+@@ -4,12 +4,6 @@
+ /* CONFIG_CC_VERSION_TEXT (Do not delete this comment. See help in Kconfig) */
+-#ifdef CONFIG_CPU_BIG_ENDIAN
+-#define __BIG_ENDIAN 4321
+-#else
+-#define __LITTLE_ENDIAN 1234
+-#endif
+-
+ #define __ARG_PLACEHOLDER_1 0,
+ #define __take_second_arg(__ignored, val, ...) val