From: Greg Kroah-Hartman Date: Tue, 9 Apr 2024 09:40:51 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.15.154~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96a80a08ca815522e72938f145d66ffbc5f4b1fe;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: objtool-add-asm-version-of-stack_frame_non_standard.patch x86-cpufeatures-add-cpuid_lnx_5-to-track-recently-added-linux-defined-word.patch --- diff --git a/queue-5.10/objtool-add-asm-version-of-stack_frame_non_standard.patch b/queue-5.10/objtool-add-asm-version-of-stack_frame_non_standard.patch new file mode 100644 index 00000000000..c357a5408c1 --- /dev/null +++ b/queue-5.10/objtool-add-asm-version-of-stack_frame_non_standard.patch @@ -0,0 +1,71 @@ +From 081df94301e317e84c3413686043987da2c3e39d Mon Sep 17 00:00:00 2001 +From: Josh Poimboeuf +Date: Thu, 21 Jan 2021 15:29:23 -0600 +Subject: objtool: Add asm version of STACK_FRAME_NON_STANDARD + +From: Josh Poimboeuf + +commit 081df94301e317e84c3413686043987da2c3e39d upstream. + +To be used for adding asm functions to the ignore list. The "aw" is +needed to help the ELF section metadata match GCC-created sections. +Otherwise the linker creates duplicate sections instead of combining +them. + +Signed-off-by: Josh Poimboeuf +Link: https://lore.kernel.org/r/8faa476f9a5ac89af27944ec184c89f95f3c6c49.1611263462.git.jpoimboe@redhat.com +Signed-off-by: Daniel Sneddon +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/objtool.h | 8 ++++++++ + tools/include/linux/objtool.h | 8 ++++++++ + 2 files changed, 16 insertions(+) + +--- a/include/linux/objtool.h ++++ b/include/linux/objtool.h +@@ -141,6 +141,12 @@ struct unwind_hint { + .popsection + .endm + ++.macro STACK_FRAME_NON_STANDARD func:req ++ .pushsection .discard.func_stack_frame_non_standard, "aw" ++ .long \func - . ++ .popsection ++.endm ++ + #endif /* __ASSEMBLY__ */ + + #else /* !CONFIG_STACK_VALIDATION */ +@@ -158,6 +164,8 @@ struct unwind_hint { + .endm + .macro ANNOTATE_NOENDBR + .endm ++.macro STACK_FRAME_NON_STANDARD func:req ++.endm + #endif + + #endif /* CONFIG_STACK_VALIDATION */ +--- a/tools/include/linux/objtool.h ++++ b/tools/include/linux/objtool.h +@@ -141,6 +141,12 @@ struct unwind_hint { + .popsection + .endm + ++.macro STACK_FRAME_NON_STANDARD func:req ++ .pushsection .discard.func_stack_frame_non_standard, "aw" ++ .long \func - . ++ .popsection ++.endm ++ + #endif /* __ASSEMBLY__ */ + + #else /* !CONFIG_STACK_VALIDATION */ +@@ -158,6 +164,8 @@ struct unwind_hint { + .endm + .macro ANNOTATE_NOENDBR + .endm ++.macro STACK_FRAME_NON_STANDARD func:req ++.endm + #endif + + #endif /* CONFIG_STACK_VALIDATION */ diff --git a/queue-5.10/series b/queue-5.10/series index 26d36a93c6b..13177b91080 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -241,3 +241,5 @@ riscv-fix-spurious-errors-from-__get-put_kernel_nofault.patch x86-bugs-fix-the-srso-mitigation-on-zen3-4.patch x86-retpoline-do-the-necessary-fixup-to-the-zen3-4-srso-return-thunk-for-srso.patch mptcp-don-t-account-accept-of-non-mpc-client-as-fallback-to-tcp.patch +x86-cpufeatures-add-cpuid_lnx_5-to-track-recently-added-linux-defined-word.patch +objtool-add-asm-version-of-stack_frame_non_standard.patch diff --git a/queue-5.10/x86-cpufeatures-add-cpuid_lnx_5-to-track-recently-added-linux-defined-word.patch b/queue-5.10/x86-cpufeatures-add-cpuid_lnx_5-to-track-recently-added-linux-defined-word.patch new file mode 100644 index 00000000000..2071db85ff0 --- /dev/null +++ b/queue-5.10/x86-cpufeatures-add-cpuid_lnx_5-to-track-recently-added-linux-defined-word.patch @@ -0,0 +1,60 @@ +From 8cb4a9a82b21623dbb4b3051dd30d98356cf95bc Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Thu, 4 Apr 2024 17:16:14 -0700 +Subject: x86/cpufeatures: Add CPUID_LNX_5 to track recently added Linux-defined word + +From: Sean Christopherson + +commit 8cb4a9a82b21623dbb4b3051dd30d98356cf95bc upstream. + +Add CPUID_LNX_5 to track cpufeatures' word 21, and add the appropriate +compile-time assert in KVM to prevent direct lookups on the features in +CPUID_LNX_5. KVM uses X86_FEATURE_* flags to manage guest CPUID, and so +must translate features that are scattered by Linux from the Linux-defined +bit to the hardware-defined bit, i.e. should never try to directly access +scattered features in guest CPUID. + +Opportunistically add NR_CPUID_WORDS to enum cpuid_leafs, along with a +compile-time assert in KVM's CPUID infrastructure to ensure that future +additions update cpuid_leafs along with NCAPINTS. + +No functional change intended. + +Fixes: 7f274e609f3d ("x86/cpufeatures: Add new word for scattered features") +Cc: Sandipan Das +Signed-off-by: Sean Christopherson +Acked-by: Dave Hansen +Signed-off-by: Linus Torvalds +Signed-off-by: Daniel Sneddon +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/include/asm/cpufeature.h | 2 ++ + arch/x86/kvm/cpuid.h | 2 ++ + 2 files changed, 4 insertions(+) + +--- a/arch/x86/include/asm/cpufeature.h ++++ b/arch/x86/include/asm/cpufeature.h +@@ -33,6 +33,8 @@ enum cpuid_leafs + CPUID_7_EDX, + CPUID_8000_001F_EAX, + CPUID_8000_0021_EAX, ++ CPUID_LNX_5, ++ NR_CPUID_WORDS, + }; + + #ifdef CONFIG_X86_FEATURE_NAMES +--- a/arch/x86/kvm/cpuid.h ++++ b/arch/x86/kvm/cpuid.h +@@ -76,10 +76,12 @@ static const struct cpuid_reg reverse_cp + */ + static __always_inline void reverse_cpuid_check(unsigned int x86_leaf) + { ++ BUILD_BUG_ON(NR_CPUID_WORDS != NCAPINTS); + BUILD_BUG_ON(x86_leaf == CPUID_LNX_1); + BUILD_BUG_ON(x86_leaf == CPUID_LNX_2); + BUILD_BUG_ON(x86_leaf == CPUID_LNX_3); + BUILD_BUG_ON(x86_leaf == CPUID_LNX_4); ++ BUILD_BUG_ON(x86_leaf == CPUID_LNX_5); + BUILD_BUG_ON(x86_leaf >= ARRAY_SIZE(reverse_cpuid)); + BUILD_BUG_ON(reverse_cpuid[x86_leaf].function == 0); + }