Patch "x86/speculation: Change FILL_RETURN_BUFFER to work with objtool" has been added to the 4.19-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: Change FILL_RETURN_BUFFER to work with objtool

to the 4.19-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-change-fill_return_buffer-to-work-with-objtool.patch
and it can be found in the queue-4.19 subdirectory.

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


>From stable-owner@xxxxxxxxxxxxxxx Thu Nov 17 10:21:54 2022
From: Suleiman Souhlal <suleiman@xxxxxxxxxx>
Date: Thu, 17 Nov 2022 18:19:37 +0900
Subject: x86/speculation: Change FILL_RETURN_BUFFER to work with objtool
To: stable@xxxxxxxxxxxxxxx
Cc: x86@xxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, bp@xxxxxxxxx, pbonzini@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, jpoimboe@xxxxxxxxxx, cascardo@xxxxxxxxxxxxx, surajjs@xxxxxxxxxx, ssouhlal@xxxxxxxxxxx, suleiman@xxxxxxxxxx
Message-ID: <20221117091952.1940850-20-suleiman@xxxxxxxxxx>

From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

commit 089dd8e53126ebaf506e2dc0bf89d652c36bfc12 upstream.

Change FILL_RETURN_BUFFER so that objtool groks it and can generate
correct ORC unwind information.

 - Since ORC is alternative invariant; that is, all alternatives
   should have the same ORC entries, the __FILL_RETURN_BUFFER body
   can not be part of an alternative.

   Therefore, move it out of the alternative and keep the alternative
   as a sort of jump_label around it.

 - Use the ANNOTATE_INTRA_FUNCTION_CALL annotation to white-list
   these 'funny' call instructions to nowhere.

 - Use UNWIND_HINT_EMPTY to 'fill' the speculation traps, otherwise
   objtool will consider them unreachable.

 - Move the RSP adjustment into the loop, such that the loop has a
   deterministic stack layout.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
Acked-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Link: https://lkml.kernel.org/r/20200428191700.032079304@xxxxxxxxxxxxx
[cascardo: fixup because of backport of ba6e31af2be96c4d0536f2152ed6f7b6c11bca47 ("x86/speculation: Add LFENCE to RSB fill sequence")]
[cascardo: no intra-function call validation support]
[cascardo: avoid UNWIND_HINT_EMPTY because of svm]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
Signed-off-by: Suleiman Souhlal <suleiman@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/include/asm/nospec-branch.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -4,11 +4,13 @@
 #define _ASM_X86_NOSPEC_BRANCH_H_
 
 #include <linux/static_key.h>
+#include <linux/frame.h>
 
 #include <asm/alternative.h>
 #include <asm/alternative-asm.h>
 #include <asm/cpufeatures.h>
 #include <asm/msr-index.h>
+#include <asm/unwind_hints.h>
 
 /*
  * Fill the CPU return stack buffer.
@@ -51,9 +53,9 @@
 	lfence;					\
 	jmp	775b;				\
 774:						\
+	add	$(BITS_PER_LONG/8) * 2, sp;	\
 	dec	reg;				\
 	jnz	771b;				\
-	add	$(BITS_PER_LONG/8) * nr, sp;	\
 	/* barrier for jnz misprediction */	\
 	lfence;
 #else
@@ -158,10 +160,8 @@
   */
 .macro FILL_RETURN_BUFFER reg:req nr:req ftr:req
 #ifdef CONFIG_RETPOLINE
-	ANNOTATE_NOSPEC_ALTERNATIVE
-	ALTERNATIVE "jmp .Lskip_rsb_\@",				\
-		__stringify(__FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP))	\
-		\ftr
+	ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr
+	__FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP)
 .Lskip_rsb_\@:
 #endif
 .endm


Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are

queue-4.19/x86-speculation-disable-rrsba-behavior.patch
queue-4.19/revert-x86-speculation-add-rsb-vm-exit-protections.patch
queue-4.19/kvm-vmx-fix-ibrs-handling-after-vmexit.patch
queue-4.19/kvm-vmx-prevent-guest-rsb-poisoning-attacks-with-eibrs.patch
queue-4.19/x86-cpufeature-add-facility-to-check-for-min-microcode-revisions.patch
queue-4.19/x86-bugs-keep-a-per-cpu-ia32_spec_ctrl-value.patch
queue-4.19/x86-cpu-amd-enumerate-btc_no.patch
queue-4.19/x86-speculation-fix-firmware-entry-spec_ctrl-handling.patch
queue-4.19/x86-speculation-add-spectre_v2-ibrs-option-to-support-kernel-ibrs.patch
queue-4.19/x86-cpu-add-consistent-cpu-match-macros.patch
queue-4.19/x86-speculation-remove-x86_spec_ctrl_mask.patch
queue-4.19/x86-bugs-add-cannon-lake-to-retbleed-affected-cpu-list.patch
queue-4.19/x86-bugs-warn-when-ibrs-mitigation-is-selected-on-enhanced-ibrs-parts.patch
queue-4.19/x86-speculation-fill-rsb-on-vmexit-for-ibrs.patch
queue-4.19/x86-cpu-add-a-steppings-field-to-struct-x86_cpu_id.patch
queue-4.19/x86-common-stamp-out-the-stepping-madness.patch
queue-4.19/x86-bugs-split-spectre_v2_select_mitigation-and-spectre_v2_user_select_mitigation.patch
queue-4.19/x86-bugs-report-intel-retbleed-vulnerability.patch
queue-4.19/x86-speculation-change-fill_return_buffer-to-work-with-objtool.patch
queue-4.19/x86-cpufeatures-move-retpoline-flags-to-word-11.patch
queue-4.19/x86-speculation-fix-spec_ctrl-write-on-smt-state-change.patch
queue-4.19/x86-bugs-optimize-spec_ctrl-msr-writes.patch
queue-4.19/x86-bugs-report-amd-retbleed-vulnerability.patch
queue-4.19/x86-speculation-fix-rsb-filling-with-config_retpoline-n.patch
queue-4.19/x86-cpufeature-fix-various-quality-problems-in-the-asm-cpu_device_hd.h-header.patch
queue-4.19/intel_idle-disable-ibrs-during-long-idle.patch
queue-4.19/x86-speculation-use-declare_per_cpu-for-x86_spec_ctrl_current.patch
queue-4.19/x86-entry-remove-skip_r11rcx.patch
queue-4.19/x86-speculation-use-cached-host-spec_ctrl-value-for-guest-entry-exit.patch
queue-4.19/x86-devicetable-move-x86-specific-macro-out-of-generic-code.patch
queue-4.19/x86-bugs-add-amd-retbleed-boot-parameter.patch
queue-4.19/x86-entry-add-kernel-ibrs-implementation.patch
queue-4.19/revert-x86-cpu-add-a-steppings-field-to-struct-x86_cpu_id.patch
queue-4.19/x86-speculation-add-rsb-vm-exit-protections.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux