linux/arch/x86/entry
Pawan Gupta 7390db8aea x86/bhi: Add support for clearing branch history at syscall entry
Branch History Injection (BHI) attacks may allow a malicious application to
influence indirect branch prediction in kernel by poisoning the branch
history. eIBRS isolates indirect branch targets in ring0.  The BHB can
still influence the choice of indirect branch predictor entry, and although
branch predictor entries are isolated between modes when eIBRS is enabled,
the BHB itself is not isolated between modes.

Alder Lake and new processors supports a hardware control BHI_DIS_S to
mitigate BHI.  For older processors Intel has released a software sequence
to clear the branch history on parts that don't support BHI_DIS_S. Add
support to execute the software sequence at syscall entry and VMexit to
overwrite the branch history.

For now, branch history is not cleared at interrupt entry, as malicious
applications are not believed to have sufficient control over the
registers, since previous register state is cleared at interrupt
entry. Researchers continue to poke at this area and it may become
necessary to clear at interrupt entry as well in the future.

This mitigation is only defined here. It is enabled later.

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Co-developed-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
Signed-off-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: Josh Poimboeuf <jpoimboe@kernel.org>
History 2024-04-08 19:27:05 +02:00
..
syscalls lsm/stable-6.8 PR 20240105 2024-01-09 12:57:46 -08:00
vdso x86/vdso: Fix rethunk patching for vdso-image-x32.o too 2024-03-26 10:47:14 +01:00
vsyscall x86/ptrace: Cleanup the definition of the pt_regs structure 2024-01-31 22:01:13 +01:00
calling.h Core x86 changes for v6.9: 2024-03-11 19:53:15 -07:00
common.c x86/bhi: Add support for clearing branch history at syscall entry 2024-04-08 19:27:05 +02:00
entry.S Core x86 changes for v6.9: 2024-03-11 19:53:15 -07:00
entry_32.S Core x86 changes for v6.9: 2024-03-11 19:53:15 -07:00
entry_64.S x86/bhi: Add support for clearing branch history at syscall entry 2024-04-08 19:27:05 +02:00
entry_64_compat.S x86/bhi: Add support for clearing branch history at syscall entry 2024-04-08 19:27:05 +02:00
entry_64_fred.S x86/entry: Add fred_entry_from_kvm() for VMX to handle IRQ/NMI 2024-01-31 22:03:16 +01:00
entry_fred.c x86/fred: Add FRED initialization functions 2024-01-31 22:03:32 +01:00
Makefile x86/fred: FRED entry/exit and dispatch code 2024-01-31 22:02:31 +01:00
syscall_32.c x86/syscall: Don't force use of indirect calls for system calls 2024-04-08 19:27:05 +02:00
syscall_64.c x86/syscall: Don't force use of indirect calls for system calls 2024-04-08 19:27:05 +02:00
syscall_x32.c x86/syscall: Don't force use of indirect calls for system calls 2024-04-08 19:27:05 +02:00
thunk_32.S x86/retpoline: Ensure default return thunk isn't used at runtime 2024-02-12 11:42:15 +01:00
thunk_64.S x86/retpoline: Ensure default return thunk isn't used at runtime 2024-02-12 11:42:15 +01:00