[edk2] [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its bugs

Laszlo Ersek posted 6 patches 5 years, 9 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf                                |   1 -
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskFileExplorer.c                         | 140 ------------
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c                                 |   2 +-
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h                                 |  39 ----
MdePkg/Include/Library/UefiLib.h                                                     |  86 ++++++++
MdePkg/Library/UefiLib/UefiLib.c                                                     | 226 ++++++++++++++++++++
MdePkg/Library/UefiLib/UefiLib.inf                                                   |   1 +
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf                                     |   1 -
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c                                      | 141 +-----------
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf        |   1 -
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c | 151 +------------
ShellPkg/Include/Library/ShellLib.h                                                  |   2 -
ShellPkg/Library/UefiShellLib/UefiShellLib.c                                         | 118 +---------
ShellPkg/Library/UefiShellLib/UefiShellLib.inf                                       |   3 +-
14 files changed, 321 insertions(+), 591 deletions(-)
[edk2] [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its bugs
Posted by Laszlo Ersek 5 years, 9 months ago
Repo:   https://github.com/lersek/edk2.git
Branch: open_file_by_devpath_tiano_1008

This series addresses
<https://bugzilla.tianocore.org/show_bug.cgi?id=1008>.

In this version of the patch set, EfiOpenFileByDevicePath() is not added
to the FrameworkUefiLib instance. If FrameworkUefiLib actually needs a
definition of the function, I suggest that we add it once everybody
agrees on the implementation.

Tested with:

- MdeModulePkg/RamDiskDxe: created a virtual disk from an ISO file,
  using the HII form; browsed the disk contents from the UEFI shell.

- NetworkPkg/TlsAuthConfigDxe: loaded a CA certificate from a file via
  the HII form, successfully booted via HTTPSv4.

- SecurityPkg/SecureBootConfigDxe: enrolled
  "MicCorKEKCA2011_2011-06-24.crt", "MicCorUEFCA2011_2011-06-27.crt",
  and "MicWinProPCA2011_2011-10-19.crt", using the HII form; verified
  Secure Boot with a Fedora guest.

- ShellPkg/UefiShellLib: couldn't test the "old shell method" code path.
  Help with testing would be appreciated.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Roman Bacik <roman.bacik@broadcom.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>

Thanks,
Laszlo

Laszlo Ersek (6):
  MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()
  MdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib
    API
  NetworkPkg/TlsAuthConfigDxe: replace OpenFileByDevicePath() with
    UefiLib API
  SecurityPkg/SecureBootConfigDxe: replace OpenFileByDevicePath() with
    UefiLib API
  ShellPkg/UefiShellLib: drop DeviceHandle param of
    ShellOpenFileByDevicePath()
  ShellPkg/UefiShellLib: rebase ShellOpenFileByDevicePath() to UefiLib
    API

 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf                                |   1 -
 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskFileExplorer.c                         | 140 ------------
 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c                                 |   2 +-
 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h                                 |  39 ----
 MdePkg/Include/Library/UefiLib.h                                                     |  86 ++++++++
 MdePkg/Library/UefiLib/UefiLib.c                                                     | 226 ++++++++++++++++++++
 MdePkg/Library/UefiLib/UefiLib.inf                                                   |   1 +
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf                                     |   1 -
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c                                      | 141 +-----------
 SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf        |   1 -
 SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c | 151 +------------
 ShellPkg/Include/Library/ShellLib.h                                                  |   2 -
 ShellPkg/Library/UefiShellLib/UefiShellLib.c                                         | 118 +---------
 ShellPkg/Library/UefiShellLib/UefiShellLib.inf                                       |   3 +-
 14 files changed, 321 insertions(+), 591 deletions(-)

-- 
2.14.1.3.gb7cf6e02401b

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its bugs
Posted by Carsey, Jaben 5 years, 9 months ago
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

One question (do hold up push). Is there a reason to use the former over the latter? I use latter and I see you use the former.

ASSERT(EFI_ERROR (Status));
ASSERT_EFI_ERROR (Status);

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Wednesday, July 18, 2018 1:51 PM
> To: edk2-devel-01 <edk2-devel@lists.01.org>
> Cc: Zhang, Chao B <chao.b.zhang@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Wu, Jiaxin
> <jiaxin.wu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
> Roman Bacik <roman.bacik@broadcom.com>; Ni, Ruiyu
> <ruiyu.ni@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its
> bugs
> Importance: High
> 
> Repo:   https://github.com/lersek/edk2.git
> Branch: open_file_by_devpath_tiano_1008
> 
> This series addresses
> <https://bugzilla.tianocore.org/show_bug.cgi?id=1008>.
> 
> In this version of the patch set, EfiOpenFileByDevicePath() is not added
> to the FrameworkUefiLib instance. If FrameworkUefiLib actually needs a
> definition of the function, I suggest that we add it once everybody
> agrees on the implementation.
> 
> Tested with:
> 
> - MdeModulePkg/RamDiskDxe: created a virtual disk from an ISO file,
>   using the HII form; browsed the disk contents from the UEFI shell.
> 
> - NetworkPkg/TlsAuthConfigDxe: loaded a CA certificate from a file via
>   the HII form, successfully booted via HTTPSv4.
> 
> - SecurityPkg/SecureBootConfigDxe: enrolled
>   "MicCorKEKCA2011_2011-06-24.crt", "MicCorUEFCA2011_2011-06-27.crt",
>   and "MicWinProPCA2011_2011-10-19.crt", using the HII form; verified
>   Secure Boot with a Fedora guest.
> 
> - ShellPkg/UefiShellLib: couldn't test the "old shell method" code path.
>   Help with testing would be appreciated.
> 
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Roman Bacik <roman.bacik@broadcom.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (6):
>   MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()
>   MdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib
>     API
>   NetworkPkg/TlsAuthConfigDxe: replace OpenFileByDevicePath() with
>     UefiLib API
>   SecurityPkg/SecureBootConfigDxe: replace OpenFileByDevicePath() with
>     UefiLib API
>   ShellPkg/UefiShellLib: drop DeviceHandle param of
>     ShellOpenFileByDevicePath()
>   ShellPkg/UefiShellLib: rebase ShellOpenFileByDevicePath() to UefiLib
>     API
> 
>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> |   1 -
>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskFileExplorer.c
> | 140 ------------
>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
> |   2 +-
>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
> |  39 ----
>  MdePkg/Include/Library/UefiLib.h                                                     |  86 ++++++++
>  MdePkg/Library/UefiLib/UefiLib.c                                                     | 226
> ++++++++++++++++++++
>  MdePkg/Library/UefiLib/UefiLib.inf                                                   |   1 +
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf                                     |   1
> -
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c                                      | 141
> +-----------
> 
> SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi
> gDxe.inf        |   1 -
> 
> SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi
> gFileExplorer.c | 151 +------------
>  ShellPkg/Include/Library/ShellLib.h                                                  |   2 -
>  ShellPkg/Library/UefiShellLib/UefiShellLib.c                                         | 118 +-------
> --
>  ShellPkg/Library/UefiShellLib/UefiShellLib.inf                                       |   3 +-
>  14 files changed, 321 insertions(+), 591 deletions(-)
> 
> --
> 2.14.1.3.gb7cf6e02401b

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its bugs
Posted by Ard Biesheuvel 5 years, 9 months ago
On 19 July 2018 at 06:15, Carsey, Jaben <jaben.carsey@intel.com> wrote:
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
>
> One question (do hold up push). Is there a reason to use the former over the latter? I use latter and I see you use the former.
>
> ASSERT(EFI_ERROR (Status));
> ASSERT_EFI_ERROR (Status);
>

The former asserts that an error has occurred, the latter does the opposite.

It seems Laszlo is using this to ensure we don't end up in the error
handling path if no error occurred.

-- 
Ard.


>> -----Original Message-----
>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>> Sent: Wednesday, July 18, 2018 1:51 PM
>> To: edk2-devel-01 <edk2-devel@lists.01.org>
>> Cc: Zhang, Chao B <chao.b.zhang@intel.com>; Dong, Eric
>> <eric.dong@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Wu, Jiaxin
>> <jiaxin.wu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Gao, Liming
>> <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
>> Roman Bacik <roman.bacik@broadcom.com>; Ni, Ruiyu
>> <ruiyu.ni@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Zeng, Star
>> <star.zeng@intel.com>
>> Subject: [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its
>> bugs
>> Importance: High
>>
>> Repo:   https://github.com/lersek/edk2.git
>> Branch: open_file_by_devpath_tiano_1008
>>
>> This series addresses
>> <https://bugzilla.tianocore.org/show_bug.cgi?id=1008>.
>>
>> In this version of the patch set, EfiOpenFileByDevicePath() is not added
>> to the FrameworkUefiLib instance. If FrameworkUefiLib actually needs a
>> definition of the function, I suggest that we add it once everybody
>> agrees on the implementation.
>>
>> Tested with:
>>
>> - MdeModulePkg/RamDiskDxe: created a virtual disk from an ISO file,
>>   using the HII form; browsed the disk contents from the UEFI shell.
>>
>> - NetworkPkg/TlsAuthConfigDxe: loaded a CA certificate from a file via
>>   the HII form, successfully booted via HTTPSv4.
>>
>> - SecurityPkg/SecureBootConfigDxe: enrolled
>>   "MicCorKEKCA2011_2011-06-24.crt", "MicCorUEFCA2011_2011-06-27.crt",
>>   and "MicWinProPCA2011_2011-10-19.crt", using the HII form; verified
>>   Secure Boot with a Fedora guest.
>>
>> - ShellPkg/UefiShellLib: couldn't test the "old shell method" code path.
>>   Help with testing would be appreciated.
>>
>> Cc: Chao Zhang <chao.b.zhang@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Jaben Carsey <jaben.carsey@intel.com>
>> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Roman Bacik <roman.bacik@broadcom.com>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Cc: Siyuan Fu <siyuan.fu@intel.com>
>> Cc: Star Zeng <star.zeng@intel.com>
>>
>> Thanks,
>> Laszlo
>>
>> Laszlo Ersek (6):
>>   MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()
>>   MdeModulePkg/RamDiskDxe: replace OpenFileByDevicePath() with UefiLib
>>     API
>>   NetworkPkg/TlsAuthConfigDxe: replace OpenFileByDevicePath() with
>>     UefiLib API
>>   SecurityPkg/SecureBootConfigDxe: replace OpenFileByDevicePath() with
>>     UefiLib API
>>   ShellPkg/UefiShellLib: drop DeviceHandle param of
>>     ShellOpenFileByDevicePath()
>>   ShellPkg/UefiShellLib: rebase ShellOpenFileByDevicePath() to UefiLib
>>     API
>>
>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
>> |   1 -
>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskFileExplorer.c
>> | 140 ------------
>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
>> |   2 +-
>>  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
>> |  39 ----
>>  MdePkg/Include/Library/UefiLib.h                                                     |  86 ++++++++
>>  MdePkg/Library/UefiLib/UefiLib.c                                                     | 226
>> ++++++++++++++++++++
>>  MdePkg/Library/UefiLib/UefiLib.inf                                                   |   1 +
>>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf                                     |   1
>> -
>>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c                                      | 141
>> +-----------
>>
>> SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi
>> gDxe.inf        |   1 -
>>
>> SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi
>> gFileExplorer.c | 151 +------------
>>  ShellPkg/Include/Library/ShellLib.h                                                  |   2 -
>>  ShellPkg/Library/UefiShellLib/UefiShellLib.c                                         | 118 +-------
>> --
>>  ShellPkg/Library/UefiShellLib/UefiShellLib.inf                                       |   3 +-
>>  14 files changed, 321 insertions(+), 591 deletions(-)
>>
>> --
>> 2.14.1.3.gb7cf6e02401b
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/6] UefiLib: centralize OpenFileByDevicePath() and fix its bugs
Posted by Laszlo Ersek 5 years, 9 months ago
On 07/19/18 02:07, Ard Biesheuvel wrote:
> On 19 July 2018 at 06:15, Carsey, Jaben <jaben.carsey@intel.com> wrote:
>> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
>>
>> One question (do hold up push). Is there a reason to use the former over the latter? I use latter and I see you use the former.
>>
>> ASSERT(EFI_ERROR (Status));
>> ASSERT_EFI_ERROR (Status);
>>
> 
> The former asserts that an error has occurred, the latter does the opposite.

Right -- the latter is actually a misnomer; that macro should have
always been called "ASSERT_NO_EFI_ERROR" :)

> It seems Laszlo is using this to ensure we don't end up in the error
> handling path if no error occurred.

Sort of -- the way I put it for myself was, ensure that we don't exit on
the error path without returning an error status to the caller. So it's
less about control flow, and more about setting (or recognizing) error
statuses at all locations that jump to the error path.

But I guess that's just both sides of the same coin. :)

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel