public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
@ 2019-08-22  2:36 Michael D Kinney
  2019-08-22  2:36 ` [Patch][edk2-stable201908 1/2] " Michael D Kinney
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Michael D Kinney @ 2019-08-22  2:36 UTC (permalink / raw)
  To: devel; +Cc: Jordan Justen, Ray Ni, Andrew Fish, Tim Lewis

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

When UEFI Applications or UEFI Drivers are unloaded,
the PeCoffLoaderUnloadImageExtraAction() needs to unload
the image using FreeLibrary() if the image was successfully
loaded using LoadLibrrayEx().

This is a regression from the Nt32Pkg that supported
unloading applications and drivers as well as loading
the same application or driver multiple times.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Tim Lewis <tim.lewis@insyde.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Michael D Kinney (2):
  EmulatorPkg/Win/Host: Fix image unload regression
  EmulatorPkg/Win/Host: Fix SecPrint() log line endings

 EmulatorPkg/Win/Host/WinHost.c | 193 +++++++++++++++++++++++++++++----
 1 file changed, 174 insertions(+), 19 deletions(-)

-- 
2.21.0.windows.1


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

* [Patch][edk2-stable201908 1/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-22  2:36 [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Michael D Kinney
@ 2019-08-22  2:36 ` Michael D Kinney
  2019-08-22 23:10   ` [edk2-devel] " Ni, Ray
  2019-08-22  2:36 ` [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host: Fix SecPrint() log line endings Michael D Kinney
  2019-08-26 19:31 ` [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Tim Lewis
  2 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2019-08-22  2:36 UTC (permalink / raw)
  To: devel; +Cc: Jordan Justen, Ray Ni, Andrew Fish, Tim Lewis

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

When UEFI Applications or UEFI Drivers are unloaded,
the PeCoffLoaderUnloadImageExtraAction() needs to unload
the image using FreeLibrary() if the image was successfully
loaded using LoadLibrrayEx().

This is a regression from the Nt32Pkg that supported
unloading applications and drivers as well as loading
the same application or driver multiple times.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Tim Lewis <tim.lewis@insyde.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 EmulatorPkg/Win/Host/WinHost.c | 167 +++++++++++++++++++++++++++++++--
 1 file changed, 161 insertions(+), 6 deletions(-)

diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c
index dd52075f98..9c6acac279 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -19,6 +19,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define SE_TIME_ZONE_NAME                 TEXT("SeTimeZonePrivilege")
 #endif
 
+//
+// The growth size for array of module handle entries
+//
+#define MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE 0x100
+
+//
+// Module handle entry structure
+//
+typedef struct {
+  CHAR8   *PdbPointer;
+  VOID    *ModHandle;
+} PDB_NAME_TO_MOD_HANDLE;
+
+//
+// An Array to hold the module handles
+//
+PDB_NAME_TO_MOD_HANDLE  *mPdbNameModHandleArray = NULL;
+UINTN                   mPdbNameModHandleArraySize = 0;
+
 //
 // Default information about where the FD is located.
 //  This array gets filled in with information from PcdWinNtFirmwareVolume
@@ -840,6 +859,120 @@ Returns:
   return Count;
 }
 
+/**
+  Store the ModHandle in an array indexed by the Pdb File name.
+  The ModHandle is needed to unload the image.
+  @param ImageContext - Input data returned from PE Laoder Library. Used to find the
+                 .PDB file name of the PE Image.
+  @param ModHandle    - Returned from LoadLibraryEx() and stored for call to
+                 FreeLibrary().
+  @return   return EFI_SUCCESS when ModHandle was stored.
+--*/
+EFI_STATUS
+AddModHandle (
+  IN  PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext,
+  IN  VOID                                 *ModHandle
+  )
+
+{
+  UINTN                   Index;
+  PDB_NAME_TO_MOD_HANDLE  *Array;
+  UINTN                   PreviousSize;
+  PDB_NAME_TO_MOD_HANDLE  *TempArray;
+  HANDLE                  Handle;
+  UINTN                   Size;
+
+  //
+  // Return EFI_ALREADY_STARTED if this DLL has already been loaded
+  //
+  Array = mPdbNameModHandleArray;
+  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
+    if (Array->PdbPointer != NULL && Array->ModHandle == ModHandle) {
+      return EFI_ALREADY_STARTED;
+    }
+  }
+
+  Array = mPdbNameModHandleArray;
+  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
+    if (Array->PdbPointer == NULL) {
+      //
+      // Make a copy of the stirng and store the ModHandle
+      //
+      Handle = GetProcessHeap ();
+      Size = AsciiStrLen (ImageContext->PdbPointer) + 1;
+      Array->PdbPointer = HeapAlloc ( Handle, HEAP_ZERO_MEMORY, Size);
+      ASSERT (Array->PdbPointer != NULL);
+
+      AsciiStrCpyS (Array->PdbPointer, Size, ImageContext->PdbPointer);
+      Array->ModHandle = ModHandle;
+      return EFI_SUCCESS;
+    }
+  }
+
+  //
+  // No free space in mPdbNameModHandleArray so grow it by
+  // MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE entires.
+  //
+  PreviousSize = mPdbNameModHandleArraySize * sizeof (PDB_NAME_TO_MOD_HANDLE);
+  mPdbNameModHandleArraySize += MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE;
+  //
+  // re-allocate a new buffer and copy the old values to the new locaiton.
+  //
+  TempArray = HeapAlloc (GetProcessHeap (),
+                                HEAP_ZERO_MEMORY,
+                                mPdbNameModHandleArraySize * sizeof (PDB_NAME_TO_MOD_HANDLE)
+                               );
+
+  CopyMem ((VOID *) (UINTN) TempArray, (VOID *) (UINTN)mPdbNameModHandleArray, PreviousSize);
+
+  HeapFree (GetProcessHeap (), 0, mPdbNameModHandleArray);
+
+  mPdbNameModHandleArray = TempArray;
+  if (mPdbNameModHandleArray == NULL) {
+    ASSERT (FALSE);
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  return AddModHandle (ImageContext, ModHandle);
+}
+
+/**
+  Return the ModHandle and delete the entry in the array.
+   @param  ImageContext - Input data returned from PE Laoder Library. Used to find the
+                 .PDB file name of the PE Image.
+  @return
+    ModHandle - ModHandle assoicated with ImageContext is returned
+    NULL      - No ModHandle associated with ImageContext
+**/
+VOID *
+RemoveModHandle (
+  IN  PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
+  )
+{
+  UINTN                   Index;
+  PDB_NAME_TO_MOD_HANDLE  *Array;
+
+  if (ImageContext->PdbPointer == NULL) {
+    //
+    // If no PDB pointer there is no ModHandle so return NULL
+    //
+    return NULL;
+  }
+
+  Array = mPdbNameModHandleArray;
+  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
+    if ((Array->PdbPointer != NULL) && (AsciiStrCmp(Array->PdbPointer, ImageContext->PdbPointer) == 0)) {
+      //
+      // If you find a match return it and delete the entry
+      //
+      HeapFree (GetProcessHeap (), 0, Array->PdbPointer);
+      Array->PdbPointer = NULL;
+      return Array->ModHandle;
+    }
+  }
+
+  return NULL;
+}
 
 VOID
 EFIAPI
@@ -847,6 +980,7 @@ PeCoffLoaderRelocateImageExtraAction (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
   )
 {
+  EFI_STATUS        Status;
   VOID              *DllEntryPoint;
   CHAR16            *DllFileName;
   HMODULE           Library;
@@ -855,7 +989,7 @@ PeCoffLoaderRelocateImageExtraAction (
   ASSERT (ImageContext != NULL);
   //
   // If we load our own PE COFF images the Windows debugger can not source
-  //  level debug our code. If a valid PDB pointer exists usw it to load
+  //  level debug our code. If a valid PDB pointer exists use it to load
   //  the *.dll file as a library using Windows* APIs. This allows
   //  source level debug. The image is still loaded and relocated
   //  in the Framework memory space like on a real system (by the code above),
@@ -913,10 +1047,22 @@ PeCoffLoaderRelocateImageExtraAction (
     }
 
     if ((Library != NULL) && (DllEntryPoint != NULL)) {
-      ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
-      SecPrint ("LoadLibraryEx (%S,\n               NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName);
+      Status = AddModHandle (ImageContext, Library);
+      if (Status == EFI_ALREADY_STARTED) {
+        //
+        // If the DLL has already been loaded before, then this instance of the DLL can not be debugged.
+        //
+        ImageContext->PdbPointer = NULL;
+        SecPrint ("WARNING: DLL already loaded.  No source level debug %S.\n\r", DllFileName);
+      } else {
+        //
+        // This DLL is not already loaded, so source level debugging is supported.
+        //
+        ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
+        SecPrint ("LoadLibraryEx (\n\r  %S,\n\r  NULL, DONT_RESOLVE_DLL_REFERENCES)\n\r", DllFileName);
+      }
     } else {
-      SecPrint ("WARNING: No source level debug %S. \n", DllFileName);
+      SecPrint ("WARNING: No source level debug %S. \n\r", DllFileName);
     }
 
     free (DllFileName);
@@ -926,13 +1072,22 @@ PeCoffLoaderRelocateImageExtraAction (
 VOID
 EFIAPI
 PeCoffLoaderUnloadImageExtraAction (
-  IN PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
+  IN PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
 )
 {
+  VOID  *ModHandle;
+
   ASSERT (ImageContext != NULL);
+
+  ModHandle = RemoveModHandle (ImageContext);
+  if (ModHandle != NULL) {
+    FreeLibrary (ModHandle);
+    SecPrint ("FreeLibrary (\n\r  %s)\n\r", ImageContext->PdbPointer);
+  } else {
+    SecPrint ("WARNING: Unload image without source level debug\n\r");
+  }
 }
 
-
 VOID
 _ModuleEntryPoint (
   VOID
-- 
2.21.0.windows.1


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

* [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host: Fix SecPrint() log line endings
  2019-08-22  2:36 [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Michael D Kinney
  2019-08-22  2:36 ` [Patch][edk2-stable201908 1/2] " Michael D Kinney
@ 2019-08-22  2:36 ` Michael D Kinney
  2019-08-22 23:12   ` [edk2-devel] " Ni, Ray
  2019-08-26 19:31 ` [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Tim Lewis
  2 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2019-08-22  2:36 UTC (permalink / raw)
  To: devel; +Cc: Jordan Justen, Ray Ni, Andrew Fish, Tim Lewis

Update use of SecPrint() to consistently use \n\r for
line endings to fix formatting issues in the debug log.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Tim Lewis <tim.lewis@insyde.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 EmulatorPkg/Win/Host/WinHost.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c
index 9c6acac279..9aba3c8959 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -408,7 +408,7 @@ Returns:
   MemorySizeStr      = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
   FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
 
-  SecPrint ("\nEDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/\n");
+  SecPrint ("\n\rEDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/\n\r");
 
   //
   // Determine the first thread available to this process.
@@ -450,7 +450,7 @@ Returns:
   gSystemMemoryCount  = CountSeparatorsInString (MemorySizeStr, '!') + 1;
   gSystemMemory       = calloc (gSystemMemoryCount, sizeof (NT_SYSTEM_MEMORY));
   if (gSystemMemory == NULL) {
-    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n", MemorySizeStr);
+    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n\r", MemorySizeStr);
     exit (1);
   }
 
@@ -460,13 +460,13 @@ Returns:
   gFdInfoCount  = CountSeparatorsInString (FirmwareVolumesStr, '!') + 1;
   gFdInfo       = calloc (gFdInfoCount, sizeof (NT_FD_INFO));
   if (gFdInfo == NULL) {
-    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n", FirmwareVolumesStr);
+    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n\r", FirmwareVolumesStr);
     exit (1);
   }
   //
   // Setup Boot Mode.
   //
-  SecPrint ("  BootMode 0x%02x\n", PcdGet32 (PcdEmuBootMode));
+  SecPrint ("  BootMode 0x%02x\n\r", PcdGet32 (PcdEmuBootMode));
 
   //
   //  Allocate 128K memory to emulate temp memory for PEI.
@@ -476,12 +476,12 @@ Returns:
   TemporaryRamSize = TEMPORARY_RAM_SIZE;
   TemporaryRam     = VirtualAlloc (NULL, (SIZE_T) (TemporaryRamSize), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
   if (TemporaryRam == NULL) {
-    SecPrint ("ERROR : Can not allocate enough space for SecStack\n");
+    SecPrint ("ERROR : Can not allocate enough space for SecStack\n\r");
     exit (1);
   }
   SetMem32 (TemporaryRam, TemporaryRamSize, PcdGet32 (PcdInitValueInTempStack));
 
-  SecPrint ("  OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n",
+  SecPrint ("  OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n\r",
     TemporaryRamSize / SIZE_1KB,
     TemporaryRam
     );
@@ -503,7 +503,7 @@ Returns:
               &Size
               );
     if (EFI_ERROR (Status)) {
-      SecPrint ("ERROR : Could not allocate PeiServicesTablePage @ %p\n", EmuMagicPage);
+      SecPrint ("ERROR : Could not allocate PeiServicesTablePage @ %p\n\r", EmuMagicPage);
       return EFI_DEVICE_ERROR;
     }
   }
@@ -514,7 +514,7 @@ Returns:
   //
   FileNamePtr = AllocateCopyPool (StrSize (FirmwareVolumesStr), FirmwareVolumesStr);
   if (FileNamePtr == NULL) {
-    SecPrint ("ERROR : Can not allocate memory for firmware volume string\n");
+    SecPrint ("ERROR : Can not allocate memory for firmware volume string\n\r");
     exit (1);
   }
 
@@ -540,11 +540,11 @@ Returns:
               &gFdInfo[Index].Size
               );
     if (EFI_ERROR (Status)) {
-      SecPrint ("ERROR : Can not open Firmware Device File %S (0x%X).  Exiting.\n", FileName, Status);
+      SecPrint ("ERROR : Can not open Firmware Device File %S (0x%X).  Exiting.\n\r", FileName, Status);
       exit (1);
     }
 
-    SecPrint ("  FD loaded from %S\n", FileName);
+    SecPrint ("  FD loaded from %S", FileName);
 
     if (SecFile == NULL) {
       //
@@ -565,7 +565,7 @@ Returns:
       }
     }
 
-    SecPrint ("\n");
+    SecPrint ("\n\r");
   }
   //
   // Calculate memory regions and store the information in the gSystemMemory
@@ -590,7 +590,7 @@ Returns:
     MemorySizeStr = MemorySizeStr + Index1 + 1;
   }
 
-  SecPrint ("\n");
+  SecPrint ("\n\r");
 
   //
   // Hand off to SEC Core
@@ -601,7 +601,7 @@ Returns:
   // If we get here, then the SEC Core returned. This is an error as SEC should
   //  always hand off to PEI Core and then on to DXE Core.
   //
-  SecPrint ("ERROR : SEC returned\n");
+  SecPrint ("ERROR : SEC returned\n\r");
   exit (1);
 }
 
-- 
2.21.0.windows.1


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

* Re: [edk2-devel] [Patch][edk2-stable201908 1/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-22  2:36 ` [Patch][edk2-stable201908 1/2] " Michael D Kinney
@ 2019-08-22 23:10   ` Ni, Ray
  0 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2019-08-22 23:10 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kinney, Michael D
  Cc: Justen, Jordan L, Andrew Fish, Tim Lewis

Mike,
Thanks for fixing this regression issue.

I also did a comparison between this and the Nt32 accordingly code.
They are almost the same.

I also noticed your unit test steps in Bugzilla and the behavior is expected.

I agree and also suggest that this fix to be included in the coming stable tag release.

Reviewed-by: Ray Ni <ray.ni@intel.com>



> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael D
> Kinney
> Sent: Thursday, August 22, 2019 10:36 AM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Ni, Ray <ray.ni@intel.com>;
> Andrew Fish <afish@apple.com>; Tim Lewis <tim.lewis@insyde.com>
> Subject: [edk2-devel] [Patch][edk2-stable201908 1/2] EmulatorPkg/Win/Host:
> Fix image unload regression
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=2104
> 
> When UEFI Applications or UEFI Drivers are unloaded, the
> PeCoffLoaderUnloadImageExtraAction() needs to unload the image using
> FreeLibrary() if the image was successfully loaded using LoadLibrrayEx().
> 
> This is a regression from the Nt32Pkg that supported unloading applications and
> drivers as well as loading the same application or driver multiple times.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Tim Lewis <tim.lewis@insyde.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  EmulatorPkg/Win/Host/WinHost.c | 167
> +++++++++++++++++++++++++++++++--
>  1 file changed, 161 insertions(+), 6 deletions(-)
> 
> diff --git a/EmulatorPkg/Win/Host/WinHost.c
> b/EmulatorPkg/Win/Host/WinHost.c index dd52075f98..9c6acac279 100644
> --- a/EmulatorPkg/Win/Host/WinHost.c
> +++ b/EmulatorPkg/Win/Host/WinHost.c
> @@ -19,6 +19,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #define SE_TIME_ZONE_NAME                 TEXT("SeTimeZonePrivilege")
>  #endif
> 
> +//
> +// The growth size for array of module handle entries // #define
> +MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE 0x100
> +
> +//
> +// Module handle entry structure
> +//
> +typedef struct {
> +  CHAR8   *PdbPointer;
> +  VOID    *ModHandle;
> +} PDB_NAME_TO_MOD_HANDLE;
> +
> +//
> +// An Array to hold the module handles
> +//
> +PDB_NAME_TO_MOD_HANDLE  *mPdbNameModHandleArray = NULL;
> +UINTN                   mPdbNameModHandleArraySize = 0;
> +
>  //
>  // Default information about where the FD is located.
>  //  This array gets filled in with information from PcdWinNtFirmwareVolume
> @@ -840,6 +859,120 @@ Returns:
>    return Count;
>  }
> 
> +/**
> +  Store the ModHandle in an array indexed by the Pdb File name.
> +  The ModHandle is needed to unload the image.
> +  @param ImageContext - Input data returned from PE Laoder Library. Used to
> find the
> +                 .PDB file name of the PE Image.
> +  @param ModHandle    - Returned from LoadLibraryEx() and stored for call to
> +                 FreeLibrary().
> +  @return   return EFI_SUCCESS when ModHandle was stored.
> +--*/
> +EFI_STATUS
> +AddModHandle (
> +  IN  PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext,
> +  IN  VOID                                 *ModHandle
> +  )
> +
> +{
> +  UINTN                   Index;
> +  PDB_NAME_TO_MOD_HANDLE  *Array;
> +  UINTN                   PreviousSize;
> +  PDB_NAME_TO_MOD_HANDLE  *TempArray;
> +  HANDLE                  Handle;
> +  UINTN                   Size;
> +
> +  //
> +  // Return EFI_ALREADY_STARTED if this DLL has already been loaded  //
> + Array = mPdbNameModHandleArray;  for (Index = 0; Index <
> + mPdbNameModHandleArraySize; Index++, Array++) {
> +    if (Array->PdbPointer != NULL && Array->ModHandle == ModHandle) {
> +      return EFI_ALREADY_STARTED;
> +    }
> +  }
> +
> +  Array = mPdbNameModHandleArray;
> +  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
> +    if (Array->PdbPointer == NULL) {
> +      //
> +      // Make a copy of the stirng and store the ModHandle
> +      //
> +      Handle = GetProcessHeap ();
> +      Size = AsciiStrLen (ImageContext->PdbPointer) + 1;
> +      Array->PdbPointer = HeapAlloc ( Handle, HEAP_ZERO_MEMORY, Size);
> +      ASSERT (Array->PdbPointer != NULL);
> +
> +      AsciiStrCpyS (Array->PdbPointer, Size, ImageContext->PdbPointer);
> +      Array->ModHandle = ModHandle;
> +      return EFI_SUCCESS;
> +    }
> +  }
> +
> +  //
> +  // No free space in mPdbNameModHandleArray so grow it by  //
> + MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE entires.
> +  //
> +  PreviousSize = mPdbNameModHandleArraySize * sizeof
> + (PDB_NAME_TO_MOD_HANDLE);  mPdbNameModHandleArraySize +=
> + MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE;
> +  //
> +  // re-allocate a new buffer and copy the old values to the new locaiton.
> +  //
> +  TempArray = HeapAlloc (GetProcessHeap (),
> +                                HEAP_ZERO_MEMORY,
> +                                mPdbNameModHandleArraySize * sizeof
> (PDB_NAME_TO_MOD_HANDLE)
> +                               );
> +
> +  CopyMem ((VOID *) (UINTN) TempArray, (VOID *)
> + (UINTN)mPdbNameModHandleArray, PreviousSize);
> +
> +  HeapFree (GetProcessHeap (), 0, mPdbNameModHandleArray);
> +
> +  mPdbNameModHandleArray = TempArray;
> +  if (mPdbNameModHandleArray == NULL) {
> +    ASSERT (FALSE);
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  return AddModHandle (ImageContext, ModHandle); }
> +
> +/**
> +  Return the ModHandle and delete the entry in the array.
> +   @param  ImageContext - Input data returned from PE Laoder Library. Used
> to find the
> +                 .PDB file name of the PE Image.
> +  @return
> +    ModHandle - ModHandle assoicated with ImageContext is returned
> +    NULL      - No ModHandle associated with ImageContext
> +**/
> +VOID *
> +RemoveModHandle (
> +  IN  PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
> +  )
> +{
> +  UINTN                   Index;
> +  PDB_NAME_TO_MOD_HANDLE  *Array;
> +
> +  if (ImageContext->PdbPointer == NULL) {
> +    //
> +    // If no PDB pointer there is no ModHandle so return NULL
> +    //
> +    return NULL;
> +  }
> +
> +  Array = mPdbNameModHandleArray;
> +  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
> +    if ((Array->PdbPointer != NULL) && (AsciiStrCmp(Array->PdbPointer,
> ImageContext->PdbPointer) == 0)) {
> +      //
> +      // If you find a match return it and delete the entry
> +      //
> +      HeapFree (GetProcessHeap (), 0, Array->PdbPointer);
> +      Array->PdbPointer = NULL;
> +      return Array->ModHandle;
> +    }
> +  }
> +
> +  return NULL;
> +}
> 
>  VOID
>  EFIAPI
> @@ -847,6 +980,7 @@ PeCoffLoaderRelocateImageExtraAction (
>    IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
>    )
>  {
> +  EFI_STATUS        Status;
>    VOID              *DllEntryPoint;
>    CHAR16            *DllFileName;
>    HMODULE           Library;
> @@ -855,7 +989,7 @@ PeCoffLoaderRelocateImageExtraAction (
>    ASSERT (ImageContext != NULL);
>    //
>    // If we load our own PE COFF images the Windows debugger can not source
> -  //  level debug our code. If a valid PDB pointer exists usw it to load
> +  //  level debug our code. If a valid PDB pointer exists use it to
> + load
>    //  the *.dll file as a library using Windows* APIs. This allows
>    //  source level debug. The image is still loaded and relocated
>    //  in the Framework memory space like on a real system (by the code above),
> @@ -913,10 +1047,22 @@ PeCoffLoaderRelocateImageExtraAction (
>      }
> 
>      if ((Library != NULL) && (DllEntryPoint != NULL)) {
> -      ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN)
> DllEntryPoint;
> -      SecPrint ("LoadLibraryEx (%S,\n               NULL,
> DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName);
> +      Status = AddModHandle (ImageContext, Library);
> +      if (Status == EFI_ALREADY_STARTED) {
> +        //
> +        // If the DLL has already been loaded before, then this instance of the DLL
> can not be debugged.
> +        //
> +        ImageContext->PdbPointer = NULL;
> +        SecPrint ("WARNING: DLL already loaded.  No source level debug %S.\n\r",
> DllFileName);
> +      } else {
> +        //
> +        // This DLL is not already loaded, so source level debugging is supported.
> +        //
> +        ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN)
> DllEntryPoint;
> +        SecPrint ("LoadLibraryEx (\n\r  %S,\n\r  NULL,
> DONT_RESOLVE_DLL_REFERENCES)\n\r", DllFileName);
> +      }
>      } else {
> -      SecPrint ("WARNING: No source level debug %S. \n", DllFileName);
> +      SecPrint ("WARNING: No source level debug %S. \n\r",
> + DllFileName);
>      }
> 
>      free (DllFileName);
> @@ -926,13 +1072,22 @@ PeCoffLoaderRelocateImageExtraAction (  VOID
> EFIAPI  PeCoffLoaderUnloadImageExtraAction (
> -  IN PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
> +  IN PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
>  )
>  {
> +  VOID  *ModHandle;
> +
>    ASSERT (ImageContext != NULL);
> +
> +  ModHandle = RemoveModHandle (ImageContext);  if (ModHandle != NULL) {
> +    FreeLibrary (ModHandle);
> +    SecPrint ("FreeLibrary (\n\r  %s)\n\r", ImageContext->PdbPointer);
> + } else {
> +    SecPrint ("WARNING: Unload image without source level debug\n\r");
> + }
>  }
> 
> -
>  VOID
>  _ModuleEntryPoint (
>    VOID
> --
> 2.21.0.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host: Fix SecPrint() log line endings
  2019-08-22  2:36 ` [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host: Fix SecPrint() log line endings Michael D Kinney
@ 2019-08-22 23:12   ` Ni, Ray
  0 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2019-08-22 23:12 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kinney, Michael D
  Cc: Justen, Jordan L, Andrew Fish, Tim Lewis

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael D
> Kinney
> Sent: Thursday, August 22, 2019 10:36 AM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Ni, Ray <ray.ni@intel.com>;
> Andrew Fish <afish@apple.com>; Tim Lewis <tim.lewis@insyde.com>
> Subject: [edk2-devel] [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host:
> Fix SecPrint() log line endings
> 
> Update use of SecPrint() to consistently use \n\r for
> line endings to fix formatting issues in the debug log.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Tim Lewis <tim.lewis@insyde.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  EmulatorPkg/Win/Host/WinHost.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/EmulatorPkg/Win/Host/WinHost.c
> b/EmulatorPkg/Win/Host/WinHost.c
> index 9c6acac279..9aba3c8959 100644
> --- a/EmulatorPkg/Win/Host/WinHost.c
> +++ b/EmulatorPkg/Win/Host/WinHost.c
> @@ -408,7 +408,7 @@ Returns:
>    MemorySizeStr      = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
>    FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
> 
> -  SecPrint ("\nEDK II WIN Host Emulation Environment from
> http://www.tianocore.org/edk2/\n");
> +  SecPrint ("\n\rEDK II WIN Host Emulation Environment from
> http://www.tianocore.org/edk2/\n\r");
> 
>    //
>    // Determine the first thread available to this process.
> @@ -450,7 +450,7 @@ Returns:
>    gSystemMemoryCount  = CountSeparatorsInString (MemorySizeStr, '!') + 1;
>    gSystemMemory       = calloc (gSystemMemoryCount, sizeof
> (NT_SYSTEM_MEMORY));
>    if (gSystemMemory == NULL) {
> -    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n",
> MemorySizeStr);
> +    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n\r",
> MemorySizeStr);
>      exit (1);
>    }
> 
> @@ -460,13 +460,13 @@ Returns:
>    gFdInfoCount  = CountSeparatorsInString (FirmwareVolumesStr, '!') + 1;
>    gFdInfo       = calloc (gFdInfoCount, sizeof (NT_FD_INFO));
>    if (gFdInfo == NULL) {
> -    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n",
> FirmwareVolumesStr);
> +    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n\r",
> FirmwareVolumesStr);
>      exit (1);
>    }
>    //
>    // Setup Boot Mode.
>    //
> -  SecPrint ("  BootMode 0x%02x\n", PcdGet32 (PcdEmuBootMode));
> +  SecPrint ("  BootMode 0x%02x\n\r", PcdGet32 (PcdEmuBootMode));
> 
>    //
>    //  Allocate 128K memory to emulate temp memory for PEI.
> @@ -476,12 +476,12 @@ Returns:
>    TemporaryRamSize = TEMPORARY_RAM_SIZE;
>    TemporaryRam     = VirtualAlloc (NULL, (SIZE_T) (TemporaryRamSize),
> MEM_COMMIT, PAGE_EXECUTE_READWRITE);
>    if (TemporaryRam == NULL) {
> -    SecPrint ("ERROR : Can not allocate enough space for SecStack\n");
> +    SecPrint ("ERROR : Can not allocate enough space for SecStack\n\r");
>      exit (1);
>    }
>    SetMem32 (TemporaryRam, TemporaryRamSize, PcdGet32
> (PcdInitValueInTempStack));
> 
> -  SecPrint ("  OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n",
> +  SecPrint ("  OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n\r",
>      TemporaryRamSize / SIZE_1KB,
>      TemporaryRam
>      );
> @@ -503,7 +503,7 @@ Returns:
>                &Size
>                );
>      if (EFI_ERROR (Status)) {
> -      SecPrint ("ERROR : Could not allocate PeiServicesTablePage @ %p\n",
> EmuMagicPage);
> +      SecPrint ("ERROR : Could not allocate PeiServicesTablePage @ %p\n\r",
> EmuMagicPage);
>        return EFI_DEVICE_ERROR;
>      }
>    }
> @@ -514,7 +514,7 @@ Returns:
>    //
>    FileNamePtr = AllocateCopyPool (StrSize (FirmwareVolumesStr),
> FirmwareVolumesStr);
>    if (FileNamePtr == NULL) {
> -    SecPrint ("ERROR : Can not allocate memory for firmware volume string\n");
> +    SecPrint ("ERROR : Can not allocate memory for firmware volume
> string\n\r");
>      exit (1);
>    }
> 
> @@ -540,11 +540,11 @@ Returns:
>                &gFdInfo[Index].Size
>                );
>      if (EFI_ERROR (Status)) {
> -      SecPrint ("ERROR : Can not open Firmware Device File %S (0x%X).
> Exiting.\n", FileName, Status);
> +      SecPrint ("ERROR : Can not open Firmware Device File %S (0x%X).
> Exiting.\n\r", FileName, Status);
>        exit (1);
>      }
> 
> -    SecPrint ("  FD loaded from %S\n", FileName);
> +    SecPrint ("  FD loaded from %S", FileName);
> 
>      if (SecFile == NULL) {
>        //
> @@ -565,7 +565,7 @@ Returns:
>        }
>      }
> 
> -    SecPrint ("\n");
> +    SecPrint ("\n\r");
>    }
>    //
>    // Calculate memory regions and store the information in the gSystemMemory
> @@ -590,7 +590,7 @@ Returns:
>      MemorySizeStr = MemorySizeStr + Index1 + 1;
>    }
> 
> -  SecPrint ("\n");
> +  SecPrint ("\n\r");
> 
>    //
>    // Hand off to SEC Core
> @@ -601,7 +601,7 @@ Returns:
>    // If we get here, then the SEC Core returned. This is an error as SEC should
>    //  always hand off to PEI Core and then on to DXE Core.
>    //
> -  SecPrint ("ERROR : SEC returned\n");
> +  SecPrint ("ERROR : SEC returned\n\r");
>    exit (1);
>  }
> 
> --
> 2.21.0.windows.1
> 
> 
> 


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

* Re: [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-22  2:36 [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Michael D Kinney
  2019-08-22  2:36 ` [Patch][edk2-stable201908 1/2] " Michael D Kinney
  2019-08-22  2:36 ` [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host: Fix SecPrint() log line endings Michael D Kinney
@ 2019-08-26 19:31 ` Tim Lewis
  2019-08-26 20:35   ` [edk2-devel] " Ni, Ray
  2 siblings, 1 reply; 10+ messages in thread
From: Tim Lewis @ 2019-08-26 19:31 UTC (permalink / raw)
  To: 'Michael D Kinney', devel
  Cc: 'Jordan Justen', 'Ray Ni', 'Andrew Fish'

Tested-by: Tim Lewis <tim.lewis@insyde.com>

-----Original Message-----
From: Michael D Kinney <michael.d.kinney@intel.com> 
Sent: Wednesday, August 21, 2019 7:36 PM
To: devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>; Ray Ni <ray.ni@intel.com>;
Andrew Fish <afish@apple.com>; Tim Lewis <tim.lewis@insyde.com>
Subject: [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image
unload regression

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

When UEFI Applications or UEFI Drivers are unloaded, the
PeCoffLoaderUnloadImageExtraAction() needs to unload the image using
FreeLibrary() if the image was successfully loaded using LoadLibrrayEx().

This is a regression from the Nt32Pkg that supported unloading applications
and drivers as well as loading the same application or driver multiple
times.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Tim Lewis <tim.lewis@insyde.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Michael D Kinney (2):
  EmulatorPkg/Win/Host: Fix image unload regression
  EmulatorPkg/Win/Host: Fix SecPrint() log line endings

 EmulatorPkg/Win/Host/WinHost.c | 193 +++++++++++++++++++++++++++++----
 1 file changed, 174 insertions(+), 19 deletions(-)

--
2.21.0.windows.1



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

* Re: [edk2-devel] [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-26 19:31 ` [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Tim Lewis
@ 2019-08-26 20:35   ` Ni, Ray
  2019-08-26 21:01     ` Michael D Kinney
  0 siblings, 1 reply; 10+ messages in thread
From: Ni, Ray @ 2019-08-26 20:35 UTC (permalink / raw)
  To: devel@edk2.groups.io, tim.lewis@insyde.com, Kinney, Michael D
  Cc: Justen, Jordan L, 'Andrew Fish'

All,
As the package maintainer of EmulatorPkg, I should push the patches.
But I am not sure if there should be some ack from stewards regarding including this patch in the coming stable tag.

What's the process?

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tim Lewis
> Sent: Monday, August 26, 2019 12:32 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Ni, Ray <ray.ni@intel.com>; 'Andrew Fish' <afish@apple.com>
> Subject: Re: [edk2-devel] [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
> 
> Tested-by: Tim Lewis <tim.lewis@insyde.com>
> 
> -----Original Message-----
> From: Michael D Kinney <michael.d.kinney@intel.com>
> Sent: Wednesday, August 21, 2019 7:36 PM
> To: devel@edk2.groups.io
> Cc: Jordan Justen <jordan.l.justen@intel.com>; Ray Ni <ray.ni@intel.com>;
> Andrew Fish <afish@apple.com>; Tim Lewis <tim.lewis@insyde.com>
> Subject: [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image
> unload regression
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=2104
> 
> When UEFI Applications or UEFI Drivers are unloaded, the
> PeCoffLoaderUnloadImageExtraAction() needs to unload the image using
> FreeLibrary() if the image was successfully loaded using LoadLibrrayEx().
> 
> This is a regression from the Nt32Pkg that supported unloading applications
> and drivers as well as loading the same application or driver multiple
> times.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Tim Lewis <tim.lewis@insyde.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> 
> Michael D Kinney (2):
>   EmulatorPkg/Win/Host: Fix image unload regression
>   EmulatorPkg/Win/Host: Fix SecPrint() log line endings
> 
>  EmulatorPkg/Win/Host/WinHost.c | 193 +++++++++++++++++++++++++++++----
>  1 file changed, 174 insertions(+), 19 deletions(-)
> 
> --
> 2.21.0.windows.1
> 
> 
> 
> 


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

* Re: [edk2-devel] [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-26 20:35   ` [edk2-devel] " Ni, Ray
@ 2019-08-26 21:01     ` Michael D Kinney
  2019-08-26 21:10       ` Andrew Fish
  0 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2019-08-26 21:01 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io, tim.lewis@insyde.com,
	Kinney, Michael D, leif.lindholm@linaro.org,
	Andrew Fish (afish@apple.com)
  Cc: Justen, Jordan L

Ray,

Laszlo and I are OK with this change going into the stable tag.

I would like to a response from Andrew or Leif.

Mike

> -----Original Message-----
> From: Ni, Ray
> Sent: Monday, August 26, 2019 1:35 PM
> To: devel@edk2.groups.io; tim.lewis@insyde.com; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>;
> 'Andrew Fish' <afish@apple.com>
> Subject: RE: [edk2-devel] [Patch][edk2-stable201908 0/2]
> EmulatorPkg/Win/Host: Fix image unload regression
> 
> All,
> As the package maintainer of EmulatorPkg, I should push
> the patches.
> But I am not sure if there should be some ack from
> stewards regarding including this patch in the coming
> stable tag.
> 
> What's the process?
> 
> Thanks,
> Ray
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On
> Behalf Of Tim
> > Lewis
> > Sent: Monday, August 26, 2019 12:32 PM
> > To: Kinney, Michael D <michael.d.kinney@intel.com>;
> > devel@edk2.groups.io
> > Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Ni,
> Ray
> > <ray.ni@intel.com>; 'Andrew Fish' <afish@apple.com>
> > Subject: Re: [edk2-devel] [Patch][edk2-stable201908
> 0/2]
> > EmulatorPkg/Win/Host: Fix image unload regression
> >
> > Tested-by: Tim Lewis <tim.lewis@insyde.com>
> >
> > -----Original Message-----
> > From: Michael D Kinney <michael.d.kinney@intel.com>
> > Sent: Wednesday, August 21, 2019 7:36 PM
> > To: devel@edk2.groups.io
> > Cc: Jordan Justen <jordan.l.justen@intel.com>; Ray Ni
> > <ray.ni@intel.com>; Andrew Fish <afish@apple.com>; Tim
> Lewis
> > <tim.lewis@insyde.com>
> > Subject: [Patch][edk2-stable201908 0/2]
> EmulatorPkg/Win/Host: Fix
> > image unload regression
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=2104
> >
> > When UEFI Applications or UEFI Drivers are unloaded,
> the
> > PeCoffLoaderUnloadImageExtraAction() needs to unload
> the image using
> > FreeLibrary() if the image was successfully loaded
> using LoadLibrrayEx().
> >
> > This is a regression from the Nt32Pkg that supported
> unloading
> > applications and drivers as well as loading the same
> application or
> > driver multiple times.
> >
> > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Andrew Fish <afish@apple.com>
> > Cc: Tim Lewis <tim.lewis@insyde.com>
> > Signed-off-by: Michael D Kinney
> <michael.d.kinney@intel.com>
> >
> > Michael D Kinney (2):
> >   EmulatorPkg/Win/Host: Fix image unload regression
> >   EmulatorPkg/Win/Host: Fix SecPrint() log line
> endings
> >
> >  EmulatorPkg/Win/Host/WinHost.c | 193
> > +++++++++++++++++++++++++++++----
> >  1 file changed, 174 insertions(+), 19 deletions(-)
> >
> > --
> > 2.21.0.windows.1
> >
> >
> >
> > 


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

* Re: [edk2-devel] [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-26 21:01     ` Michael D Kinney
@ 2019-08-26 21:10       ` Andrew Fish
  2019-08-26 22:03         ` Ni, Ray
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Fish @ 2019-08-26 21:10 UTC (permalink / raw)
  To: Mike Kinney
  Cc: Ni, Ray, devel@edk2.groups.io, tim.lewis@insyde.com,
	leif.lindholm@linaro.org, Jordan Justen

Mike,

I'm OK with it going in.

Thanks,

Andrew Fish

> On Aug 26, 2019, at 2:01 PM, Kinney, Michael D <michael.d.kinney@intel.com> wrote:
> 
> Ray,
> 
> Laszlo and I are OK with this change going into the stable tag.
> 
> I would like to a response from Andrew or Leif.
> 
> Mike
> 
>> -----Original Message-----
>> From: Ni, Ray
>> Sent: Monday, August 26, 2019 1:35 PM
>> To: devel@edk2.groups.io; tim.lewis@insyde.com; Kinney,
>> Michael D <michael.d.kinney@intel.com>
>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>;
>> 'Andrew Fish' <afish@apple.com>
>> Subject: RE: [edk2-devel] [Patch][edk2-stable201908 0/2]
>> EmulatorPkg/Win/Host: Fix image unload regression
>> 
>> All,
>> As the package maintainer of EmulatorPkg, I should push
>> the patches.
>> But I am not sure if there should be some ack from
>> stewards regarding including this patch in the coming
>> stable tag.
>> 
>> What's the process?
>> 
>> Thanks,
>> Ray
>> 
>>> -----Original Message-----
>>> From: devel@edk2.groups.io <devel@edk2.groups.io> On
>> Behalf Of Tim
>>> Lewis
>>> Sent: Monday, August 26, 2019 12:32 PM
>>> To: Kinney, Michael D <michael.d.kinney@intel.com>;
>>> devel@edk2.groups.io
>>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Ni,
>> Ray
>>> <ray.ni@intel.com>; 'Andrew Fish' <afish@apple.com>
>>> Subject: Re: [edk2-devel] [Patch][edk2-stable201908
>> 0/2]
>>> EmulatorPkg/Win/Host: Fix image unload regression
>>> 
>>> Tested-by: Tim Lewis <tim.lewis@insyde.com>
>>> 
>>> -----Original Message-----
>>> From: Michael D Kinney <michael.d.kinney@intel.com>
>>> Sent: Wednesday, August 21, 2019 7:36 PM
>>> To: devel@edk2.groups.io
>>> Cc: Jordan Justen <jordan.l.justen@intel.com>; Ray Ni
>>> <ray.ni@intel.com>; Andrew Fish <afish@apple.com>; Tim
>> Lewis
>>> <tim.lewis@insyde.com>
>>> Subject: [Patch][edk2-stable201908 0/2]
>> EmulatorPkg/Win/Host: Fix
>>> image unload regression
>>> 
>>> https://bugzilla.tianocore.org/show_bug.cgi?id=2104
>>> 
>>> When UEFI Applications or UEFI Drivers are unloaded,
>> the
>>> PeCoffLoaderUnloadImageExtraAction() needs to unload
>> the image using
>>> FreeLibrary() if the image was successfully loaded
>> using LoadLibrrayEx().
>>> 
>>> This is a regression from the Nt32Pkg that supported
>> unloading
>>> applications and drivers as well as loading the same
>> application or
>>> driver multiple times.
>>> 
>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>> Cc: Ray Ni <ray.ni@intel.com>
>>> Cc: Andrew Fish <afish@apple.com>
>>> Cc: Tim Lewis <tim.lewis@insyde.com>
>>> Signed-off-by: Michael D Kinney
>> <michael.d.kinney@intel.com>
>>> 
>>> Michael D Kinney (2):
>>>  EmulatorPkg/Win/Host: Fix image unload regression
>>>  EmulatorPkg/Win/Host: Fix SecPrint() log line
>> endings
>>> 
>>> EmulatorPkg/Win/Host/WinHost.c | 193
>>> +++++++++++++++++++++++++++++----
>>> 1 file changed, 174 insertions(+), 19 deletions(-)
>>> 
>>> --
>>> 2.21.0.windows.1
>>> 
>>> 
>>> 
>>> 
> 


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

* Re: [edk2-devel] [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
  2019-08-26 21:10       ` Andrew Fish
@ 2019-08-26 22:03         ` Ni, Ray
  0 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2019-08-26 22:03 UTC (permalink / raw)
  To: afish@apple.com, Kinney, Michael D
  Cc: devel@edk2.groups.io, tim.lewis@insyde.com,
	leif.lindholm@linaro.org, Justen, Jordan L

pushed @ abc0155b03..30b4abc6e9.

> -----Original Message-----
> From: afish@apple.com <afish@apple.com>
> Sent: Monday, August 26, 2019 2:10 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>
> Cc: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; tim.lewis@insyde.com; leif.lindholm@linaro.org; Justen, Jordan L
> <jordan.l.justen@intel.com>
> Subject: Re: [edk2-devel] [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression
> 
> Mike,
> 
> I'm OK with it going in.
> 
> Thanks,
> 
> Andrew Fish
> 
> > On Aug 26, 2019, at 2:01 PM, Kinney, Michael D <michael.d.kinney@intel.com> wrote:
> >
> > Ray,
> >
> > Laszlo and I are OK with this change going into the stable tag.
> >
> > I would like to a response from Andrew or Leif.
> >
> > Mike
> >
> >> -----Original Message-----
> >> From: Ni, Ray
> >> Sent: Monday, August 26, 2019 1:35 PM
> >> To: devel@edk2.groups.io; tim.lewis@insyde.com; Kinney,
> >> Michael D <michael.d.kinney@intel.com>
> >> Cc: Justen, Jordan L <jordan.l.justen@intel.com>;
> >> 'Andrew Fish' <afish@apple.com>
> >> Subject: RE: [edk2-devel] [Patch][edk2-stable201908 0/2]
> >> EmulatorPkg/Win/Host: Fix image unload regression
> >>
> >> All,
> >> As the package maintainer of EmulatorPkg, I should push
> >> the patches.
> >> But I am not sure if there should be some ack from
> >> stewards regarding including this patch in the coming
> >> stable tag.
> >>
> >> What's the process?
> >>
> >> Thanks,
> >> Ray
> >>
> >>> -----Original Message-----
> >>> From: devel@edk2.groups.io <devel@edk2.groups.io> On
> >> Behalf Of Tim
> >>> Lewis
> >>> Sent: Monday, August 26, 2019 12:32 PM
> >>> To: Kinney, Michael D <michael.d.kinney@intel.com>;
> >>> devel@edk2.groups.io
> >>> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Ni,
> >> Ray
> >>> <ray.ni@intel.com>; 'Andrew Fish' <afish@apple.com>
> >>> Subject: Re: [edk2-devel] [Patch][edk2-stable201908
> >> 0/2]
> >>> EmulatorPkg/Win/Host: Fix image unload regression
> >>>
> >>> Tested-by: Tim Lewis <tim.lewis@insyde.com>
> >>>
> >>> -----Original Message-----
> >>> From: Michael D Kinney <michael.d.kinney@intel.com>
> >>> Sent: Wednesday, August 21, 2019 7:36 PM
> >>> To: devel@edk2.groups.io
> >>> Cc: Jordan Justen <jordan.l.justen@intel.com>; Ray Ni
> >>> <ray.ni@intel.com>; Andrew Fish <afish@apple.com>; Tim
> >> Lewis
> >>> <tim.lewis@insyde.com>
> >>> Subject: [Patch][edk2-stable201908 0/2]
> >> EmulatorPkg/Win/Host: Fix
> >>> image unload regression
> >>>
> >>> https://bugzilla.tianocore.org/show_bug.cgi?id=2104
> >>>
> >>> When UEFI Applications or UEFI Drivers are unloaded,
> >> the
> >>> PeCoffLoaderUnloadImageExtraAction() needs to unload
> >> the image using
> >>> FreeLibrary() if the image was successfully loaded
> >> using LoadLibrrayEx().
> >>>
> >>> This is a regression from the Nt32Pkg that supported
> >> unloading
> >>> applications and drivers as well as loading the same
> >> application or
> >>> driver multiple times.
> >>>
> >>> Cc: Jordan Justen <jordan.l.justen@intel.com>
> >>> Cc: Ray Ni <ray.ni@intel.com>
> >>> Cc: Andrew Fish <afish@apple.com>
> >>> Cc: Tim Lewis <tim.lewis@insyde.com>
> >>> Signed-off-by: Michael D Kinney
> >> <michael.d.kinney@intel.com>
> >>>
> >>> Michael D Kinney (2):
> >>>  EmulatorPkg/Win/Host: Fix image unload regression
> >>>  EmulatorPkg/Win/Host: Fix SecPrint() log line
> >> endings
> >>>
> >>> EmulatorPkg/Win/Host/WinHost.c | 193
> >>> +++++++++++++++++++++++++++++----
> >>> 1 file changed, 174 insertions(+), 19 deletions(-)
> >>>
> >>> --
> >>> 2.21.0.windows.1
> >>>
> >>>
> >>>
> >>> 
> >


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

end of thread, other threads:[~2019-08-26 22:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-22  2:36 [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Michael D Kinney
2019-08-22  2:36 ` [Patch][edk2-stable201908 1/2] " Michael D Kinney
2019-08-22 23:10   ` [edk2-devel] " Ni, Ray
2019-08-22  2:36 ` [Patch][edk2-stable201908 2/2] EmulatorPkg/Win/Host: Fix SecPrint() log line endings Michael D Kinney
2019-08-22 23:12   ` [edk2-devel] " Ni, Ray
2019-08-26 19:31 ` [Patch][edk2-stable201908 0/2] EmulatorPkg/Win/Host: Fix image unload regression Tim Lewis
2019-08-26 20:35   ` [edk2-devel] " Ni, Ray
2019-08-26 21:01     ` Michael D Kinney
2019-08-26 21:10       ` Andrew Fish
2019-08-26 22:03         ` Ni, Ray

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