]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
x86/srso: Add a Speculative RAS Overflow mitigation
authorBorislav Petkov (AMD) <bp@alien8.de>
Wed, 28 Jun 2023 09:02:39 +0000 (11:02 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 4 Sep 2023 09:19:31 +0000 (11:19 +0200)
commitb5eedb5492d926ec831aca01e496d6401988a063
treeca4daf43cc252aff6c6e454484aff7146edcf0c9
parent9bf46ed73fb4eafc0e5bb48cc74ecd8d15f1d5e0
x86/srso: Add a Speculative RAS Overflow mitigation

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: Borislav Petkov (AMD) <bp@alien8.de>
CVE-2023-20569
(backported from commit fb3bd914b3ec28f5fb697ac55c4846ac2d542855)
[cascardo: fixed conflicts with GDS mitigation]
[cascardo: fixed conflicts due to DIV0 mitigation]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
16 files changed:
Documentation/admin-guide/hw-vuln/index.rst
Documentation/admin-guide/hw-vuln/srso.rst [new file with mode: 0644]
Documentation/admin-guide/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/nospec-branch.h
arch/x86/include/asm/processor.h
arch/x86/kernel/alternative.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/vmlinux.lds.S
arch/x86/lib/retpoline.S
drivers/base/cpu.c
include/linux/cpu.h
tools/objtool/arch/x86/decode.c