From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::142; helo=mail-it1-x142.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x142.google.com (mail-it1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7CA49211A2086 for ; Fri, 21 Dec 2018 03:22:22 -0800 (PST) Received: by mail-it1-x142.google.com with SMTP id m62so6301649ith.5 for ; Fri, 21 Dec 2018 03:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dZPDsDXfn7Kp+dDELeCyHq9wnWfL1YWyEMeH98u5sAA=; b=bi03P5tiHGcHmYO4LLXX9RdhHZNwY6kPHlQRQxTm2EOWgXOuFiViExVdBWjALLTQS6 kj7ISUyQIOxOAnTmxeiGJUOyGoNGX2FEptSYxrJuFGrtsFInk3F0mcWAi2z9ppC7hNwi iluoSWraRxqrZWR1cd7ygOeH6Avce0bOTlXjs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dZPDsDXfn7Kp+dDELeCyHq9wnWfL1YWyEMeH98u5sAA=; b=i2oRNhYDWPhyZnr32VeIz7biVo7ibyGWNvvtblhBg9lpetC6erJ1bWnKZTx+Gg5U/w 3/OxUnVt1+WdCZBYzpCOX1Sbg/dZPbjMZeX2nftydiAP2NR/a9s5bGGXwO5XRCvD7U+J HhZlJ3tTuIXDsRvgux48vJmrmUVpwCNJ2RgZ6oGsCArkFc6x1lmQ0ATrM03eMH0ycq57 jCErcdxhqhehRetaYg+Q9FrlBLehJiaSzhTfGarTwWx/o3hJgoqqDPAdGe9rmcqE4Z31 fgv4SQyV9LB84gssQHBV2hTZOY+zQnMBOtjZA2lCOATPyvO/F8V4i6eZN8G3UAK8iAm8 1Dlw== X-Gm-Message-State: AA+aEWZ6VFJvmRm1lPOBMTbxEp+pXp8EON4/WFlV9Paf/U0WzAXZSvmi KOz0Y+4yaVf3PqPmvUgAJskWykj1sOZP1PLoXWTJ8g== X-Google-Smtp-Source: AFSGD/XCPWGdz5qJJr5AlsRK9tbJCfdv4nIQGrrB1t0ZmHhsPHmSpk4cfdzmmlBNmUd7FJmFlCyX3M2fPZU6Q1+oo/I= X-Received: by 2002:a05:660c:4b:: with SMTP id p11mr1695462itk.71.1545391340356; Fri, 21 Dec 2018 03:22:20 -0800 (PST) MIME-Version: 1.0 References: <20181221031106.12960-1-hao.a.wu@intel.com> In-Reply-To: <20181221031106.12960-1-hao.a.wu@intel.com> From: Ard Biesheuvel Date: Fri, 21 Dec 2018 12:22:08 +0100 Message-ID: To: Hao Wu Cc: "edk2-devel@lists.01.org" , Leif Lindholm , Liming Gao , Michael D Kinney , Jiewen Yao , Laszlo Ersek , Jian J Wang , Star Zeng , Eric Dong , Ruiyu Ni Subject: Re: [PATCH v1 0/5] Ues arch-generic API SpeculationBarrier() to replace AsmLfence() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2018 11:22:22 -0000 Content-Type: text/plain; charset="UTF-8" On Fri, 21 Dec 2018 at 04:11, Hao Wu wrote: > > 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 series will add a new BaseLib API called > SpeculationBarrier(). Different architectures will have different > implementations for this API. And the series will replace the usage of > AsmLfence() in generic codes with this newly added SpeculationBarrier(). > > For the implementations of API SpeculationBarrier() among different > architectures, this series will: > > * For IA32 and x64, SpeculationBarrier() will directly call AsmLfence(). > * For ARM and EBC architectures, an empty implementation is temporarily > added as a placeholder. We hope experts in those domains can help to > contribute the actual implementation. > > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Jiewen Yao > Cc: Laszlo Ersek > Cc: Jian J Wang > Cc: Star Zeng > Cc: Eric Dong > Cc: Ruiyu Ni > > Hao Wu (5): > MdePkg/BaseLib: Introduce new SpeculationBarrier API > MdeModulePkg/FaultTolerantWrite: Update to consume SpeculationBarrier > MdeModulePkg/SmmLockBox: Update to consume SpeculationBarrier > MdeModulePkg/Variable: Update to consume SpeculationBarrier > UefiCpuPkg/PiSmmCpuDxeSmm: Update to consume SpeculationBarrier > Thanks Hao, this looks fine to me. We've raised this with people in ARM, so we'll try and contribute the missing pieces as soon as we can. In the mean time, please go ahead and merge this as is. > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf | 2 +- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf | 2 +- > MdePkg/Library/BaseLib/BaseLib.inf | 5 +++ > MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h | 10 +++--- > MdePkg/Include/Library/BaseLib.h | 15 +++++++++ > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c | 8 ++--- > MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.c | 12 ++++---- > MdeModulePkg/Universal/Variable/RuntimeDxe/{LoadFenceDxe.c => SpeculationBarrierDxe.c} | 12 +++++--- > MdeModulePkg/Universal/Variable/RuntimeDxe/{LoadFenceSmm.c => SpeculationBarrierSmm.c} | 14 +++++---- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 6 ++-- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 24 +++++++-------- > MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c | 30 ++++++++++++++++++ > MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c | 30 ++++++++++++++++++ > MdePkg/Library/BaseLib/X86SpeculationBarrier.c | 32 ++++++++++++++++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 6 ++-- > 15 files changed, 163 insertions(+), 45 deletions(-) > rename MdeModulePkg/Universal/Variable/RuntimeDxe/{LoadFenceDxe.c => SpeculationBarrierDxe.c} (62%) > rename MdeModulePkg/Universal/Variable/RuntimeDxe/{LoadFenceSmm.c => SpeculationBarrierSmm.c} (61%) > create mode 100644 MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c > create mode 100644 MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c > create mode 100644 MdePkg/Library/BaseLib/X86SpeculationBarrier.c > > -- > 2.12.0.windows.1 >