x86/bugs: Don't fill RSB on context switch with eIBRS
authorJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 8 Apr 2025 21:47:34 +0000 (14:47 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Apr 2025 10:42:09 +0000 (12:42 +0200)
commit27ce8299bc1ec6df8306073785ff82b30b3cc5ee
tree3e4353283b8c310eaaf8874e7f0d8049d2ab7829
parent18bae0dfec15b24ec14ca17dc18603372f5f254f
x86/bugs: Don't fill RSB on context switch with eIBRS

User->user Spectre v2 attacks (including RSB) across context switches
are already mitigated by IBPB in cond_mitigation(), if enabled globally
or if either the prev or the next task has opted in to protection.  RSB
filling without IBPB serves no purpose for protecting user space, as
indirect branches are still vulnerable.

User->kernel RSB attacks are mitigated by eIBRS.  In which case the RSB
filling on context switch isn't needed, so remove it.

Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Reviewed-by: Amit Shah <amit.shah@amd.com>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://lore.kernel.org/r/98cdefe42180358efebf78e3b80752850c7a3e1b.1744148254.git.jpoimboe@kernel.org
arch/x86/kernel/cpu/bugs.c
arch/x86/mm/tlb.c