android_kernel_xiaomi_sm7250/arch
Pawan Gupta 48eb8d6ac7 x86/speculation: Disable RRSBA behavior
commit 4ad3278df6fe2b0852b00d5757fc2ccd8e92c26e upstream.

Some Intel processors may use alternate predictors for RETs on
RSB-underflow. This condition may be vulnerable to Branch History
Injection (BHI) and intramode-BTI.

Kernel earlier added spectre_v2 mitigation modes (eIBRS+Retpolines,
eIBRS+LFENCE, Retpolines) which protect indirect CALLs and JMPs against
such attacks. However, on RSB-underflow, RET target prediction may
fallback to alternate predictors. As a result, RET's predicted target
may get influenced by branch history.

A new MSR_IA32_SPEC_CTRL bit (RRSBA_DIS_S) controls this fallback
behavior when in kernel mode. When set, RETs will not take predictions
from alternate predictors, hence mitigating RETs as well. Support for
this is enumerated by CPUID.7.2.EDX[RRSBA_CTRL] (bit2).

For spectre v2 mitigation, when a user selects a mitigation that
protects indirect CALLs and JMPs against BHI and intramode-BTI, set
RRSBA_DIS_S also to protect RETs for RSB-underflow case.

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
[bwh: Backported to 5.15: adjust context in scattered.c]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sam: Fixed for missing X86_FEATURE_ENTRY_IBPB context]
Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
Signed-off-by: Suleiman Souhlal <suleiman@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-23 07:53:47 +01:00
..
alpha tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:10:37 +02:00
arc arc: iounmap() arg is volatile 2022-11-03 23:52:30 +09:00
arm ARM: dts: imx6sx: add missing properties for sram 2022-10-26 13:19:40 +02:00
arm64 arm64: errata: Remove AES hwcap for COMPAT tasks 2022-11-03 23:52:25 +09:00
c6x kbuild: rename LDFLAGS to KBUILD_LDFLAGS 2018-08-24 08:22:08 +09:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-23 15:00:58 +01:00
hexagon hexagon: export raw I/O routines for modules 2021-11-26 11:36:23 +01:00
ia64 ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr() 2022-08-25 11:14:56 +02:00
m68k m68k: use fallback for random_get_entropy() instead of zero 2022-06-25 11:49:10 +02:00
microblaze microblaze: Prevent the overflow of the start 2020-02-24 08:34:53 +01:00
mips MIPS: BCM47XX: Cast memcmp() of function to (void *) 2022-10-26 13:19:36 +02:00
nds32 nds32: fix access_ok() checks in get/put_user 2022-03-28 08:41:44 +02:00
nios2 nios2: add force_successful_syscall_return() 2022-08-25 11:15:40 +02:00
openrisc openrisc: start CPU timer early in boot 2022-06-14 16:59:17 +02:00
parisc parisc: Avoid printing the hardware path twice 2022-11-10 17:46:55 +01:00
powerpc powerpc: Fix SPE Power ISA properties for e500v1 platforms 2022-10-26 13:19:35 +02:00
riscv riscv: fix build with binutils 2.38 2022-10-26 13:19:22 +02:00
s390 s390/futex: add missing EX_TABLE entry to __futex_atomic_op() 2022-11-03 23:52:29 +09:00
sh sh: machvec: Use char[] for section boundaries 2022-10-26 13:19:24 +02:00
sparc sparc: use fallback for random_get_entropy() instead of zero 2022-06-25 11:49:10 +02:00
um UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-10-26 13:19:22 +02:00
unicore32
x86 x86/speculation: Disable RRSBA behavior 2022-11-23 07:53:47 +01:00
xtensa xtensa: Fix refcount leak bug in time.c 2022-07-02 16:27:36 +02:00
.gitignore
Kconfig x86: Make ARCH_USE_MEMREMAP_PROT a generic Kconfig symbol 2021-12-22 09:19:01 +01:00