On 8/26/22 18:07, Min Xu wrote:
From: Min M Xu <min.m...@intel.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3974

CcProbeLib once was designed to probe the Confidential Computing guest
type by checking the PcdOvmfWorkArea. But this memory is allocated with
either EfiACPIMemoryNVS or EfiBootServicesData. It cannot be accessed
after ExitBootService. Please see the detailed analysis in BZ#3974.

To fix this issue, CcProbeLib is redesigned as 2 implementation:
  - SecPeiCcProbeLib
  - DxeCcProbeLib

In SecPeiCcProbeLib we check the CC guest type by reading the
PcdOvmfWorkArea. Because it is used in SEC / PEI and we don't worry about
the issues in BZ#3974.

In DxeCcProbeLib we cache the GuestType in Ovmf work area in a variable.
After that the Guest type is returned with the cached value. So that we
don't need to worry about the access to Ovmf work area after
ExitBootService.

To gurantee the GuestType is cached, we read the value in both

s/gurantee/guarantee/

constructor and CcProbe. Because in some corner case, the constructor
may be called after CcProbe. For example in MdeModulePkg/Core/Dxe/DxeMain,
BaseDebugLibSerialPortConstructor is called before
DxeCcProbeLibConstructor. While CcProbe () is called in
BaseDebugLibSerialPortConstructor.

Is there a way to put some kind of ordering in place so that CcProbe's constructor is called before BaseDebugLibSerialPortConstructor?


The reason why we probe CC guest type in 2 different ways is the global
varialbe. Global variable cannot be used in SEC/PEI and CcProbe is called

s/varialbe/variable/

Thanks,
Tom

very frequently.

Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Erdem Aktas <erdemak...@google.com>
Cc: James Bottomley <j...@linux.ibm.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Tom Lendacky <thomas.lenda...@amd.com>
Signed-off-by: Min Xu <min.m...@intel.com>
---


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92914): https://edk2.groups.io/g/devel/message/92914
Mute This Topic: https://groups.io/mt/93281453/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to