[edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

Poosapalli, Karunakar via groups.io KarunakarPoosapalli=Dell.com at groups.io
Tue Aug 29 09:49:49 UTC 2023


Thanks for sharing your inputs Jiewen.

Dear TCG Experts,

Can you please share your feedback on below proposals


Thanks & Regards
Karunakar Poosapalli
Firmware Principal Engineer, Client BIOS
Customer BIOS | Dell Core BIOS
CPG Software Engineering | Dell Technologies
Mobile +91 9951902957
Karunakar_poosapalli at Dell.Com<mailto:Karunakar_poosapalli at Dell.Com>



Internal Use - Confidential
From: Yao, Jiewen <jiewen.yao at intel.com>
Sent: Thursday, August 17, 2023 8:30 AM
To: Poosapalli, Karunakar; Gao, Liming; devel at edk2.groups.io
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages


[EXTERNAL EMAIL]
Hi Karunakar
Thanks for the patient.

I think my concern is universal, no matter it is after user input the key or not.
The clear-screen behavior is a *change*. And it may break the compatibility.

Unless all BIOS consumer in EDKII community agree the behavior, the risk is always there.


To move forward, I would like to hear the feedback from other OEM/ODM/IBV, who is consuming DxeTcg2PhysicalPresenceLib.

Thank you
Yao, Jiewen



From: Poosapalli, Karunakar <KarunakarPoosapalli at Dell.com<mailto:KarunakarPoosapalli at Dell.com>>
Sent: Thursday, August 17, 2023 1:28 AM
To: Yao, Jiewen <jiewen.yao at intel.com<mailto:jiewen.yao at intel.com>>; Gao, Liming <gaoliming at byosoft.com.cn<mailto:gaoliming at byosoft.com.cn>>; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

Hi @Yao, Jiewen<mailto:jiewen.yao at intel.com>,

Could you please share your thoughts. Please let me know if you have any queries or concerns.

Thanks & Regards
Karunakar Poosapalli
Firmware Principal Engineer, Client BIOS
Customer BIOS | Dell Core BIOS
CPG Software Engineering | Dell Technologies
Mobile +91 9951902957
Karunakar_poosapalli at Dell.Com<mailto:Karunakar_poosapalli at Dell.Com>



Internal Use - Confidential
From: Poosapalli, Karunakar
Sent: Wednesday, August 9, 2023 9:59 AM
To: Yao, Jiewen; Gao, Liming; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

Hi @Yao, Jiewen<mailto:jiewen.yao at intel.com>,

The proposed solution to clear screen will be called only when user has to provide the input key. This call will not execute in other conditions.
When there is a pending request in Tcg2, system will wait until user press input key. If there is no proper UI to customer, they feel it's system hang and go for customer support.
Even BIOS vendors also won't come to what is happening at customer box without any user information.
This is generic issue and not specific to any platform.

Thanks for sharing your thoughts.

Thanks & Regards
Karunakar Poosapalli
Firmware Principal Engineer, Client BIOS
Customer BIOS | Dell Core BIOS
CPG Software Engineering | Dell Technologies
Mobile +91 9951902957
Karunakar_poosapalli at Dell.Com<mailto:Karunakar_poosapalli at Dell.Com>



Internal Use - Confidential
From: Yao, Jiewen <jiewen.yao at intel.com<mailto:jiewen.yao at intel.com>>
Sent: Wednesday, August 9, 2023 4:44 AM
To: Poosapalli, Karunakar; Gao, Liming; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Cc: Yao, Jiewen
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages


[EXTERNAL EMAIL]
My concern is that you unconditionally clear the screen. What if someone did want to show something on the screen?

This seems an incompatible change. That is why I think it should be a platform policy.

Another way is that you may consider to duplicate the library for your platform and clear it for your platform.

Thank you
Yao, Jiewen


From: Poosapalli, Karunakar <KarunakarPoosapalli at Dell.com<mailto:KarunakarPoosapalli at Dell.com>>
Sent: Wednesday, August 9, 2023 2:13 AM
To: Yao, Jiewen <jiewen.yao at intel.com<mailto:jiewen.yao at intel.com>>; Gao, Liming <gaoliming at byosoft.com.cn<mailto:gaoliming at byosoft.com.cn>>; devel at edk2.groups.io<mailto:devel at edk2.groups.io>; Poosapalli, Karunakar <KarunakarPoosapalli at Dell.com<mailto:KarunakarPoosapalli at Dell.com>>
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

Hi @Yao, Jiewen<mailto:jiewen.yao at intel.com>,

Thanks for your review and feedback.
When there is a pending Tcg request, the control will be in Tcg2 library and it will not reach to BDS until user press the input key.
As there is no information the screen because of screen is blocked by some other messages/Logo.
So user won't able to press the key without any user information and control will not reach to BDS phase.

As TCG user confirmation is the highest priority and it blocks the POST until the user presses the input key. Before TCG messages Print on the console, there should be logic added to clear the graphics screen

Please let me know your thoughts.

Thanks & Regards
Karunakar Poosapalli
Firmware Principal Engineer, Client BIOS
Customer BIOS | Dell Core BIOS
CPG Software Engineering | Dell Technologies
Mobile +91 9951902957
Karunakar_poosapalli at Dell.Com<mailto:Karunakar_poosapalli at Dell.Com>



Internal Use - Confidential
From: Yao, Jiewen <jiewen.yao at intel.com<mailto:jiewen.yao at intel.com>>
Sent: Tuesday, July 25, 2023 5:48 PM
To: Poosapalli, Karunakar; Gao, Liming; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages


[EXTERNAL EMAIL]
Hello
I agree with you on the problem statement.

But I don't think this is a desired solution.
We expect Platform BDS to call the PhysicalPresenceLib. As such, why not clear the  screen in the platform BDS?

Thank you
Yao, Jiewen

From: Poosapalli, Karunakar <KarunakarPoosapalli at Dell.com<mailto:KarunakarPoosapalli at Dell.com>>
Sent: Monday, July 24, 2023 11:26 PM
To: Yao, Jiewen <jiewen.yao at intel.com<mailto:jiewen.yao at intel.com>>; Gao, Liming <gaoliming at byosoft.com.cn<mailto:gaoliming at byosoft.com.cn>>; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

Can you please review and share your feedback?


Thanks & Regards
Karunakar Poosapalli
Firmware Principal Engineer, Client BIOS
Customer BIOS | Dell Core BIOS
CPG Software Engineering | Dell Technologies
Mobile +91 9951902957
Karunakar_poosapalli at Dell.Com<mailto:Karunakar_poosapalli at Dell.Com>



Internal Use - Confidential
From: Poosapalli, Karunakar
Sent: Saturday, July 22, 2023 1:21 AM
To: jiewen.yao at intel.com<mailto:jiewen.yao at intel.com>; gaoliming; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Subject: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

Patch review for Bugzilla -  https://bugzilla.tianocore.org/show_bug.cgi?id=4462 [bugzilla.tianocore.org]<https://urldefense.com/v3/__https:/bugzilla.tianocore.org/show_bug.cgi?id=4462__;!!LpKI!nIImq_Eo23HxKNbpCloDgiuP_82UEmFPLYEbrs-JRjj03rfEIF5h3MqG0lMX3qzdhStA76K3O2XvHbbFilQlXDMmwg$>

>From c537f9c5c9e02c54e27466b96fe33555afccd358 Mon Sep 17 00:00:00 2001
From: Karunakar Poosapalli karunakar_poosapalli at dell.com<mailto:karunakar_poosapalli at dell.com>
Date: Sat, 22 Jul 2023 01:13:44 +0530
Subject: [PATCH] Patch - Enhance Tcg2 to clear graphics before printing the
messages on screen

[Background]
Tcg2UserConfirm() Function is used to display any user conformation messages on the console
Function Definition Full path - SecurityPkg\Library\DxeTcg2PhysicalPresenceLib\DxeTcg2PhysicalPresenceLib.c

[Issue]
In the current Tcg2UserConfirm() implementation, This function forms a destination string to be displayed on the console and directly Print the message on Console.

But there is no logic added to clear the graphics before printing the messages on the screen.

There are some scenarios where Tcg messages might have been blocked by some other GUI or messages on Console.
  1. When there are some messages or logos already displayed in the content on the console,
     TCG message will NOT be displayed or corrupted to the End user.
  2. There could be a Custom logo displaying on the screen which actually blocks the screen.

[Solution]
  1. As TCG user confirmation is the highest priority and it blocks the POST until the user
     presses the input key. Before TCG messages Print on the console, there should be logic
     added to clear the graphics screen

Cc: gaoliming gaoliming at byosoft.com.cn<mailto:gaoliming at byosoft.com.cn>
Cc: Jiewen  Jiewen.yao at intel.com<mailto:Jiewen.yao at intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4462 [bugzilla.tianocore.org]<https://urldefense.com/v3/__https:/bugzilla.tianocore.org/show_bug.cgi?id=4462__;!!LpKI!nIImq_Eo23HxKNbpCloDgiuP_82UEmFPLYEbrs-JRjj03rfEIF5h3MqG0lMX3qzdhStA76K3O2XvHbbFilQlXDMmwg$>
Signed-off-by: Karunakar Poosapalli karunakar_poosapalli at dell.com<mailto:karunakar_poosapalli at dell.com>
---
.../DxeTcg2PhysicalPresenceLib.c              | 74 +++++++++++++++++++
.../DxeTcg2PhysicalPresenceLib.inf            |  1 +
2 files changed, 75 insertions(+)

diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
index de4f5e583d..bd486f3b5b 100644
--- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
+++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
@@ -251,6 +251,74 @@ Tcg2ExecutePhysicalPresence (
   }
}

+/**
+  Clear Graphics Screen To unblock and Display TPM messages
+
+  @param[in]  VOID
+  @retval     EFI_STATUS
+**/
+EFI_STATUS
+ClearGraphicsScreenToDisplayTpmMessages()
+{
+  EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
+  EFI_STATUS Status;
+  EFI_HANDLE                              *HandleBuffer;
+  UINTN                                   NumberOfHandles;
+  UINTN                                   Index;
+  EFI_DEVICE_PATH_PROTOCOL                *GopDevicePath;
+
+  DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Entry...\n"));
+
+  Status = gBS->LocateHandleBuffer (
+            ByProtocol,
+            &gEfiGraphicsOutputProtocolGuid,
+            NULL,
+            &NumberOfHandles,
+            &HandleBuffer
+            );
+  DEBUG((DEBUG_INFO, "LocateHandleBuffer Status = %r, NumberOfHandles = %x\n", Status, NumberOfHandles));
+
+  if (EFI_ERROR (Status))
+  {
+    return Status;
+  }
+
+  for (Index = 0; Index < NumberOfHandles; Index++)
+    {
+      Status = gBS->HandleProtocol (
+                HandleBuffer[Index],
+                &gEfiDevicePathProtocolGuid,
+                (VOID *)&GopDevicePath
+                );
+      DEBUG((DEBUG_INFO, "HandleProtocol GopDevicePath Status = %r, Index = %x\n", Status, Index));
+      if (EFI_ERROR (Status))
+        {
+          continue;
+        }
+
+      Status = gBS->HandleProtocol (
+                HandleBuffer[Index],
+                &gEfiGraphicsOutputProtocolGuid,
+                (VOID **) &Gop
+                );
+      DEBUG((DEBUG_INFO, "HandleProtocol Gop Status = %r, Index = %x\n", Status, Index));
+      if (EFI_ERROR(Status))
+        {
+            continue;
+        }
+
+      // Clear the graphics screen to black
+      Status = Gop->Blt(Gop, NULL, EfiBltVideoFill, 0, 0, 0, 0, Gop->Mode->Info->HorizontalResolution, Gop->Mode->Info->VerticalResolution, 0);
+      DEBUG((DEBUG_INFO, "Gop->Blt Status = %r, Index = %x\n", Status, Index));
+      if (EFI_ERROR(Status)) {
+        continue;
+      }
+    }
+
+  gBS->FreePool (HandleBuffer);
+  DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Exit...\n"));
+  return Status;
+}
/**
   Read the specified key for user confirmation.

@@ -576,6 +644,12 @@ Tcg2UserConfirm (
   BufSize -= StrSize (ConfirmText);
   UnicodeSPrint (ConfirmText + StrLen (ConfirmText), BufSize, TmpStr1, TmpStr2);

+  //
+  //Clear Graphics Screen To unblock and Display TPM messages
+  //
+  Status = ClearGraphicsScreenToDisplayTpmMessages();
+  DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Status = %r\n", Status));
+
   DstStr[80] = L'\0';
   for (Index = 0; Index < StrLen (ConfirmText); Index += 80) {
     StrnCpyS (DstStr, sizeof (DstStr) / sizeof (CHAR16), ConfirmText + Index, sizeof (DstStr) / sizeof (CHAR16) - 1);
diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf
index e1c7c20d52..de423cfd13 100644
--- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf
+++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf
@@ -54,6 +54,7 @@
[Protocols]
   gEfiTcg2ProtocolGuid                 ## SOMETIMES_CONSUMES
   gEdkiiVariableLockProtocolGuid       ## SOMETIMES_CONSUMES
+  gEfiGraphicsOutputProtocolGuid       ## CONSUMES

 [Pcd]
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags       ## SOMETIMES_CONSUMES
--
2.17.0.windows.1



Internal Use - Confidential


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108087): https://edk2.groups.io/g/devel/message/108087
Mute This Topic: https://groups.io/mt/100333271/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230829/5e047fad/attachment-0001.htm>


More information about the edk2-devel-archive mailing list