]> git.proxmox.com Git - mirror_edk2.git/commit - MdePkg/Library/BaseLib/BaseLib.inf
MdePkg/BaseLib: Introduce new SpeculationBarrier API
authorHao Wu <hao.a.wu@intel.com>
Fri, 21 Dec 2018 01:50:39 +0000 (09:50 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 25 Dec 2018 01:15:34 +0000 (09:15 +0800)
commitd9f1cac51bd354507e880e614d11a1dc160d38a3
tree2a16d515e3032102d3a48a7a4de6896b97e756c6
parenta1b7461db369a013ce9d766583e2b11a0efc0787
MdePkg/BaseLib: Introduce new SpeculationBarrier API

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1417

X86 specific BaseLib API AsmLfence() was introduced to address the Spectre
Variant 1 (CVE-2017-5753) issue. The purpose of this API is to insert
barriers to stop speculative execution. However, the API is highly
architecture (X86) specific, and thus should be avoided using across
generic code.

To address this issue, this patch will add a new BaseLib API called
SpeculationBarrier(). Different architectures will have different
implementations for this API.

For IA32 and x64, the implementation of SpeculationBarrier() will
directly call AsmLfence().

For ARM and AARCH64, this patch will add a temporary empty implementation
as a placeholder. We hope experts in ARM can help to contribute the actual
implementation.

For EBC, similar to the ARM and AARCH64 cases, a temporary empty
implementation is added.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Include/Library/BaseLib.h
MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c [new file with mode: 0644]
MdePkg/Library/BaseLib/BaseLib.inf
MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c [new file with mode: 0644]
MdePkg/Library/BaseLib/X86SpeculationBarrier.c [new file with mode: 0644]