From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1BC1621962301 for ; Thu, 16 Aug 2018 14:33:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 445B5407541A; Thu, 16 Aug 2018 21:33:34 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-198.rdu2.redhat.com [10.10.120.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B8DA2142F20; Thu, 16 Aug 2018 21:33:32 +0000 (UTC) To: Hao Wu , edk2-devel@lists.01.org Cc: Jiewen Yao , Eric Dong , Michael D Kinney References: <20180816031422.15340-1-hao.a.wu@intel.com> <20180816031422.15340-3-hao.a.wu@intel.com> From: Laszlo Ersek Message-ID: Date: Thu, 16 Aug 2018 23:33:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180816031422.15340-3-hao.a.wu@intel.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 16 Aug 2018 21:33:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 16 Aug 2018 21:33:34 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH v2 2/2] UefiCpuPkg/SmmCpuFeaturesLib: Add RSB stuffing before RSM instruction X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Aug 2018 21:33:35 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 08/16/18 05:14, Hao Wu wrote: > 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-firmwa > re-speculative-execution-side-channel-mitigation > > Cc: Jiewen Yao > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Michael D Kinney > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm | 3 ++ > UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.nasm | 10 ++-- > UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/StuffRsb.inc | 55 ++++++++++++++++++++ > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm | 3 ++ > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm | 8 ++- > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/StuffRsb.inc | 55 ++++++++++++++++++++ > 6 files changed, 129 insertions(+), 5 deletions(-) I'm going to skip patch #2 (and I defer to the other reviewers on CC) because this patch seems to affect the "SmmCpuFeaturesLibStm" instance. And, OVMF uses none of the UefiCpuPkg/Library/SmmCpuFeaturesLib instances. It uses "OvmfPkg/Library/SmmCpuFeaturesLib", which originates from the UefiCpuPkg instance that does not support STM. Thanks! Laszlo