From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 7389521B02822 for ; Thu, 27 Sep 2018 04:45:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A272D3082134; Thu, 27 Sep 2018 11:45:19 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-187.rdu2.redhat.com [10.10.120.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57225611AA; Thu, 27 Sep 2018 11:45:18 +0000 (UTC) To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , edk2-devel@lists.01.org Cc: Chao Zhang , michael.d.kinney@intel.com, Paolo Bonzini References: From: Laszlo Ersek Message-ID: <9d023afc-13c9-d0a2-5bb4-dd889349f8ed@redhat.com> Date: Thu, 27 Sep 2018 13:45:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 27 Sep 2018 11:45:19 +0000 (UTC) Subject: Re: TCG MOR and processor caches 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: Thu, 27 Sep 2018 11:45:21 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 09/27/18 12:59, Marc-André Lureau wrote: > Hi, > > According to "TCG Platform Reset Attack Mitigation Specification", if > MOR bit is set, "it must initiate a vendor-specific method that > overwrites all of system memory and the processor caches" > > In QuarkPlatformPkg/Platform/Pei/PlatformInit/MemoryCallback.c and > QuarkPlatformPkg/Platform/Pei/PlatformInit/MrcWrapper.c, there is some > code to clear RAM, however I don't see code that would clear the > processor caches. > > For edk2/qemu, Paolo suggested it may be simpler to clear the cache > unconditionally. How would you implement that? Using > EFI_CPU_ARCH_PROTOCOL.FlushDataCache? (or direct AsmWbinvd call) I would call the appropriate low-level BaseLib.h function somewhere in OvmfPkg/PlatformPei (unconditionally, yes). I haven't looked into AsmWbinvd(), but if that's the right function, call that. (Checking the Intel SDM re: WBINVD, I agree it could be the right one.) Laszlo