summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2018-11-14 10:04:14 +0800
committerHao Wu <hao.a.wu@intel.com>2018-11-21 09:32:37 +0800
commitead3d6be19857aca5e39eef4945502b02f37c5d7 (patch)
tree41e9024288b36b9eff451d9f47d4c8c11943a868 /UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm
parent79daf8c766a38d79bf6ed5381680ad83cf770e08 (diff)
downloadedk2-ead3d6be19857aca5e39eef4945502b02f37c5d7.tar.gz
UefiCpuPkg: [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 This commit introduces a .INC file that contains the RSB logic and it can be included by .ASM files. This file is placed at directory 'UefiCpuPkg/Include/'. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Laszlo Ersek <lersek@redhat.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>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm5
1 files changed, 4 insertions, 1 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm
index 9182f0293a..2301a208d6 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.asm
@@ -1,5 +1,5 @@
;------------------------------------------------------------------------------ ;
-; Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -18,6 +18,8 @@
;
;-------------------------------------------------------------------------------
+INCLUDE StuffRsbAsm.inc
+
EXTERNDEF SmmInitHandler:PROC
EXTERNDEF gSmmCr0:DWORD
EXTERNDEF gSmmCr3:DWORD
@@ -88,6 +90,7 @@ gSmmInitStack DQ ?
movdqa xmm4, [rsp + 40h]
movdqa xmm5, [rsp + 50h]
+ StuffRsb64
rsm
SmmStartup ENDP