summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2018-08-16 10:38:10 +0800
committerHao Wu <hao.a.wu@intel.com>2018-11-16 09:00:05 +0800
commit94c43d6fa64481e2f9ee1d96949349a0b9254352 (patch)
tree1b8eb735bfd5d7611d60b02c40c14b4b6c7d7f8d /UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm
parentad4bebe21f684d404949fd60f77d461934f70393 (diff)
downloadedk2-94c43d6fa64481e2f9ee1d96949349a0b9254352.tar.gz
UefiCpuPkg/SmmCpuFeaturesLib: [CVE-2017-5715] Stuff RSB before RSM
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1093 Return Stack Buffer (RSB) is used to predict the target of RET instructions. When the RSB underflows, some processors may fall back to using branch predictors. This might impact software using the retpoline mitigation strategy on those processors. This commit will add RSB stuffing logic before returning from SMM (the RSM instruction) to avoid interfering with non-SMM usage of the retpoline technique. After the stuffing, RSB entries will contain a trap like: @SpecTrap: pause lfence jmp @SpecTrap A more detailed explanation of the purpose of commit is under the 'Branch target injection mitigation' section of the below link: https://software.intel.com/security-software-guidance/insights/host-firmware-speculative-execution-side-channel-mitigation Please note that this commit requires further actions (BZ 1091) to remove the duplicated 'StuffRsb.inc' files and merge them into one under a UefiCpuPkg package-level directory (such as UefiCpuPkg/Include/). REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1091 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> (cherry picked from commit 0df5056012e64fdf14cab0cd94e3b8630a3a88ba)
Diffstat (limited to 'UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm')
-rw-r--r--UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm8
1 files changed, 6 insertions, 2 deletions
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm
index b0ab87b0d4..3e5295986b 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm
@@ -18,6 +18,8 @@
;
;-------------------------------------------------------------------------------
+%include "StuffRsb.inc"
+
global ASM_PFX(gcStmPsd)
extern ASM_PFX(SmmStmExceptionHandler)
@@ -131,7 +133,8 @@ ASM_PFX(OnStmSetup):
wrmsr
.11:
- rsm
+ StuffRsb64
+ rsm
global ASM_PFX(OnStmTeardown)
ASM_PFX(OnStmTeardown):
@@ -175,4 +178,5 @@ ASM_PFX(OnStmTeardown):
wrmsr
.12:
- rsm
+ StuffRsb64
+ rsm