public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* TCG MOR and processor caches
@ 2018-09-27 10:59 Marc-André Lureau
  2018-09-27 11:45 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Marc-André Lureau @ 2018-09-27 10:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: Chao Zhang, Laszlo Ersek, michael.d.kinney, Paolo Bonzini

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)

thanks

-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TCG MOR and processor caches
  2018-09-27 10:59 TCG MOR and processor caches Marc-André Lureau
@ 2018-09-27 11:45 ` Laszlo Ersek
  2018-09-27 15:21   ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2018-09-27 11:45 UTC (permalink / raw)
  To: Marc-André Lureau, edk2-devel
  Cc: Chao Zhang, michael.d.kinney, Paolo Bonzini

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TCG MOR and processor caches
  2018-09-27 11:45 ` Laszlo Ersek
@ 2018-09-27 15:21   ` Laszlo Ersek
  0 siblings, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2018-09-27 15:21 UTC (permalink / raw)
  To: Marc-André Lureau, edk2-devel
  Cc: Chao Zhang, michael.d.kinney, Paolo Bonzini

On 09/27/18 13:45, Laszlo Ersek wrote:
> 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.)

BTW: I assume the caches should be flushed on all logical processors; is
that correct? If so, then EFI_PEI_MP_SERVICES_PPI will be needed, to run
AsmWbinvd() on all processors. Luckily, OvmfPkg/PlatformPei already uses
that service; see "OvmfPkg/PlatformPei/FeatureControl.c".

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-27 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 10:59 TCG MOR and processor caches Marc-André Lureau
2018-09-27 11:45 ` Laszlo Ersek
2018-09-27 15:21   ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox