Patch "x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-speculation-move-firmware_restrict_branch_speculation_-from-c-to-cpp.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From d72f4e29e6d84b7ec02ae93088aa459ac70e733b Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@xxxxxxxxxx>
Date: Wed, 21 Feb 2018 09:20:37 +0100
Subject: x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP

From: Ingo Molnar <mingo@xxxxxxxxxx>

commit d72f4e29e6d84b7ec02ae93088aa459ac70e733b upstream.

firmware_restrict_branch_speculation_*() recently started using
preempt_enable()/disable(), but those are relatively high level
primitives and cause build failures on some 32-bit builds.

Since we want to keep <asm/nospec-branch.h> low level, convert
them to macros to avoid header hell...

Cc: David Woodhouse <dwmw@xxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: arjan.van.de.ven@xxxxxxxxx
Cc: bp@xxxxxxxxx
Cc: dave.hansen@xxxxxxxxx
Cc: jmattson@xxxxxxxxxx
Cc: karahmed@xxxxxxxxx
Cc: kvm@xxxxxxxxxxxxxxx
Cc: pbonzini@xxxxxxxxxx
Cc: rkrcmar@xxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 arch/x86/include/asm/nospec-branch.h |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -257,20 +257,22 @@ static inline void indirect_branch_predi
 /*
  * With retpoline, we must use IBRS to restrict branch prediction
  * before calling into firmware.
+ *
+ * (Implemented as CPP macros due to header hell.)
  */
-static inline void firmware_restrict_branch_speculation_start(void)
-{
-	preempt_disable();
-	alternative_msr_write(MSR_IA32_SPEC_CTRL, SPEC_CTRL_IBRS,
-			      X86_FEATURE_USE_IBRS_FW);
-}
+#define firmware_restrict_branch_speculation_start()			\
+do {									\
+	preempt_disable();						\
+	alternative_msr_write(MSR_IA32_SPEC_CTRL, SPEC_CTRL_IBRS,	\
+			      X86_FEATURE_USE_IBRS_FW);			\
+} while (0)
 
-static inline void firmware_restrict_branch_speculation_end(void)
-{
-	alternative_msr_write(MSR_IA32_SPEC_CTRL, 0,
-			      X86_FEATURE_USE_IBRS_FW);
-	preempt_enable();
-}
+#define firmware_restrict_branch_speculation_end()			\
+do {									\
+	alternative_msr_write(MSR_IA32_SPEC_CTRL, 0,			\
+			      X86_FEATURE_USE_IBRS_FW);			\
+	preempt_enable();						\
+} while (0)
 
 #endif /* __ASSEMBLY__ */
 


Patches currently in stable-queue which might be from mingo@xxxxxxxxxx are

queue-4.9/x86-boot-objtool-annotate-indirect-jump-in-secondary_startup_64.patch
queue-4.9/x86-retpoline-support-retpoline-builds-with-clang.patch
queue-4.9/revert-x86-retpoline-simplify-vmexit_fill_rsb.patch
queue-4.9/nospec-include-asm-barrier.h-dependency.patch
queue-4.9/x86-speculation-use-ibrs-if-available-before-calling-into-firmware.patch
queue-4.9/x86-speculation-move-firmware_restrict_branch_speculation_-from-c-to-cpp.patch
queue-4.9/x86-speculation-objtool-annotate-indirect-calls-jumps-for-objtool.patch
queue-4.9/x86-paravirt-objtool-annotate-indirect-calls.patch
queue-4.9/nospec-kill-array_index_nospec_mask_check.patch



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]