Commit 8105f71b authored by Borislav Petkov (AMD)'s avatar Borislav Petkov (AMD) Committed by Jialin Zhang
Browse files

x86/srso: Add a Speculative RAS Overflow mitigation

stable inclusion
from stable-v5.10.189
commit 3f9b7101bea1dcb63410c016ceb266f6e9f733c9
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I7RQ67
CVE: CVE-2023-20569

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3f9b7101bea1dcb63410c016ceb266f6e9f733c9



--------------------------------

Upstream commit: fb3bd914

Add a mitigation for the speculative return address stack overflow
vulnerability found on AMD processors.

The mitigation works by ensuring all RET instructions speculate to
a controlled location, similar to how speculation is controlled in the
retpoline sequence.  To accomplish this, the __x86_return_thunk forces
the CPU to mispredict every function return using a 'safe return'
sequence.

To ensure the safety of this mitigation, the kernel must ensure that the
safe return sequence is itself free from attacker interference.  In Zen3
and Zen4, this is accomplished by creating a BTB alias between the
untraining function srso_untrain_ret_alias() and the safe return
function srso_safe_ret_alias() which results in evicting a potentially
poisoned BTB entry and using that safe one for all function returns.

In older Zen1 and Zen2, this is accomplished using a reinterpretation
technique similar to Retbleed one: srso_untrain_ret() and
srso_safe_ret().

Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

 Conflicts:
	arch/x86/include/asm/processor.h
	arch/x86/kernel/cpu/bugs.c
	arch/x86/kernel/cpu/common.c
	include/linux/cpu.h

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 6c0893ee
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment