mbox series

[U-Boot,RFC,0/8] efi_loader: rework bootefi/bootmgr

Message ID 20190305055337.3793-1-takahiro.akashi@linaro.org
Headers show
Series efi_loader: rework bootefi/bootmgr | expand

Message

AKASHI Takahiro March 5, 2019, 5:53 a.m. UTC
There are several reasons that I want to rework/refactor bootefi command
as well as bootmgr:
* Some previous commits on bootefi.c have made the code complicated
  and a bit hard to understand.

* Contrary to the other part, efi_selftest part of the code is unusal
  in terms of loading/execution path in do_bootefi().

* do_bootefi_exec() would better be implemented using load_image() along
  with start_image() to be aligned with UEFI interfaces.

* do_bootmgr_load() should also return a size of image loaded.
  This information will be needed at load_image(0 and also be used to
  verify an image with its signature in "secure boot" in the future.

* When we will support "secure boot" in the future, EFI Boot Manager
  is expected to be invoked as a standalone command without any arguments
  to mitigate security surfaces.

In this patch set,
Patch#1 is a bug fix.
Patch#2 to #5 are preparatory patches for patch#6.
Patch#7 is for standalone boot manager.

The concern that I'm aware of is:
* load_image() will take an argument of "parent_handle," but obviously
  we don't have any parent when invoking an application from command line.
  (See FIXME in patch#6.)

-Takahiro Akashi

AKASHI Takahiro (8):
  efi_loader: boottime: don't add device path protocol to image handle
  efi_loader: boottime: export efi_[un]load_image()
  efi_loader: bootmgr: return pointer and size of buffer in loading
  cmd: bootefi: move do_bootefi_bootmgr_exec() forward
  cmd: bootefi: carve out fdt handling
  cmd: bootefi: carve out efi_selftest code from do_bootefi()
  cmd: bootefi: rework do_bootefi(), using load_image API
  cmd: add efibootmgr command

 cmd/Kconfig                   |   8 +
 cmd/bootefi.c                 | 434 +++++++++++++++++++++++-----------
 include/efi_loader.h          |  14 +-
 lib/efi_loader/efi_bootmgr.c  |  41 ++--
 lib/efi_loader/efi_boottime.c |  39 ++-
 5 files changed, 360 insertions(+), 176 deletions(-)

Comments

AKASHI Takahiro March 19, 2019, 7:23 a.m. UTC | #1
Heinrich,

Do you have any comments, in particular, on patch#7 which is
core part of my RFC?

Thanks,
-Takahiro Akashi

On Tue, Mar 05, 2019 at 02:53:29PM +0900, AKASHI Takahiro wrote:
> There are several reasons that I want to rework/refactor bootefi command
> as well as bootmgr:
> * Some previous commits on bootefi.c have made the code complicated
>   and a bit hard to understand.
> 
> * Contrary to the other part, efi_selftest part of the code is unusal
>   in terms of loading/execution path in do_bootefi().
> 
> * do_bootefi_exec() would better be implemented using load_image() along
>   with start_image() to be aligned with UEFI interfaces.
> 
> * do_bootmgr_load() should also return a size of image loaded.
>   This information will be needed at load_image(0 and also be used to
>   verify an image with its signature in "secure boot" in the future.
> 
> * When we will support "secure boot" in the future, EFI Boot Manager
>   is expected to be invoked as a standalone command without any arguments
>   to mitigate security surfaces.
> 
> In this patch set,
> Patch#1 is a bug fix.
> Patch#2 to #5 are preparatory patches for patch#6.
> Patch#7 is for standalone boot manager.
> 
> The concern that I'm aware of is:
> * load_image() will take an argument of "parent_handle," but obviously
>   we don't have any parent when invoking an application from command line.
>   (See FIXME in patch#6.)
> 
> -Takahiro Akashi
> 
> AKASHI Takahiro (8):
>   efi_loader: boottime: don't add device path protocol to image handle
>   efi_loader: boottime: export efi_[un]load_image()
>   efi_loader: bootmgr: return pointer and size of buffer in loading
>   cmd: bootefi: move do_bootefi_bootmgr_exec() forward
>   cmd: bootefi: carve out fdt handling
>   cmd: bootefi: carve out efi_selftest code from do_bootefi()
>   cmd: bootefi: rework do_bootefi(), using load_image API
>   cmd: add efibootmgr command
> 
>  cmd/Kconfig                   |   8 +
>  cmd/bootefi.c                 | 434 +++++++++++++++++++++++-----------
>  include/efi_loader.h          |  14 +-
>  lib/efi_loader/efi_bootmgr.c  |  41 ++--
>  lib/efi_loader/efi_boottime.c |  39 ++-
>  5 files changed, 360 insertions(+), 176 deletions(-)
> 
> -- 
> 2.20.1
>
Heinrich Schuchardt March 21, 2019, 6:41 a.m. UTC | #2
On 3/19/19 8:23 AM, AKASHI Takahiro wrote:
> Heinrich,
>
> Do you have any comments, in particular, on patch#7 which is
> core part of my RFC?
>
> Thanks,
> -Takahiro Akashi

Hello Takahiro,

the patches are not applicable to current git master. Do you have a repo
where you have applied these patches?

Best regards

Heinrich

>
> On Tue, Mar 05, 2019 at 02:53:29PM +0900, AKASHI Takahiro wrote:
>> There are several reasons that I want to rework/refactor bootefi command
>> as well as bootmgr:
>> * Some previous commits on bootefi.c have made the code complicated
>>   and a bit hard to understand.
>>
>> * Contrary to the other part, efi_selftest part of the code is unusal
>>   in terms of loading/execution path in do_bootefi().
>>
>> * do_bootefi_exec() would better be implemented using load_image() along
>>   with start_image() to be aligned with UEFI interfaces.
>>
>> * do_bootmgr_load() should also return a size of image loaded.
>>   This information will be needed at load_image(0 and also be used to
>>   verify an image with its signature in "secure boot" in the future.
>>
>> * When we will support "secure boot" in the future, EFI Boot Manager
>>   is expected to be invoked as a standalone command without any arguments
>>   to mitigate security surfaces.
>>
>> In this patch set,
>> Patch#1 is a bug fix.
>> Patch#2 to #5 are preparatory patches for patch#6.
>> Patch#7 is for standalone boot manager.
>>
>> The concern that I'm aware of is:
>> * load_image() will take an argument of "parent_handle," but obviously
>>   we don't have any parent when invoking an application from command line.
>>   (See FIXME in patch#6.)
>>
>> -Takahiro Akashi
>>
>> AKASHI Takahiro (8):
>>   efi_loader: boottime: don't add device path protocol to image handle
>>   efi_loader: boottime: export efi_[un]load_image()
>>   efi_loader: bootmgr: return pointer and size of buffer in loading
>>   cmd: bootefi: move do_bootefi_bootmgr_exec() forward
>>   cmd: bootefi: carve out fdt handling
>>   cmd: bootefi: carve out efi_selftest code from do_bootefi()
>>   cmd: bootefi: rework do_bootefi(), using load_image API
>>   cmd: add efibootmgr command
>>
>>  cmd/Kconfig                   |   8 +
>>  cmd/bootefi.c                 | 434 +++++++++++++++++++++++-----------
>>  include/efi_loader.h          |  14 +-
>>  lib/efi_loader/efi_bootmgr.c  |  41 ++--
>>  lib/efi_loader/efi_boottime.c |  39 ++-
>>  5 files changed, 360 insertions(+), 176 deletions(-)
>>
>> --
>> 2.20.1
>>
>