]> git.baikalelectronics.ru Git - kernel.git/commit
x86/amd: Use IBPB for firmware calls
authorPeter Zijlstra <peterz@infradead.org>
Mon, 18 Jul 2022 11:41:37 +0000 (13:41 +0200)
committerBorislav Petkov <bp@suse.de>
Mon, 18 Jul 2022 13:38:09 +0000 (15:38 +0200)
commite3abb3ac20c026872da1bea6bab37dcd334fde1e
tree38be23a964f0ead645743a976f7c61e0b5846989
parent4d12eb50455169445883967409f9de42c3d6d556
x86/amd: Use IBPB for firmware calls

On AMD IBRS does not prevent Retbleed; as such use IBPB before a
firmware call to flush the branch history state.

And because in order to do an EFI call, the kernel maps a whole lot of
the kernel page table into the EFI page table, do an IBPB just in case
in order to prevent the scenario of poisoning the BTB and causing an EFI
call using the unprotected RET there.

  [ bp: Massage. ]

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220715194550.793957-1-cascardo@canonical.com
arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/nospec-branch.h
arch/x86/kernel/cpu/bugs.c