public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ming Huang <ming.huang@linaro.org>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org,
	graeme.gregory@linaro.org, ard.biesheuvel@linaro.org,
	michael.d.kinney@intel.com, lersek@redhat.com,
	wanghuiqiang@huawei.com, huangming23@huawei.com,
	zhangjinsong2@huawei.com, huangdaode@hisilicon.com,
	john.garry@huawei.com, xinliang.liu@linaro.org,
	zhangfeng56@huawei.com
Subject: Re: [PATCH edk2-platforms v3 1/5] Hisilicon/D0x: Fix secure boot bug in FlashFvbDxe
Date: Tue, 20 Nov 2018 22:29:57 +0800	[thread overview]
Message-ID: <1e4db632-9c2c-79e0-2bbe-cdc7913aa0c5@linaro.org> (raw)
In-Reply-To: <20181120125805.jn6xfxbg47izxwo2@bivouac.eciton.net>



On 11/20/2018 8:58 PM, Leif Lindholm wrote:
> On Tue, Nov 20, 2018 at 08:40:28PM +0800, Ming Huang wrote:
>>
>>
>> On 11/20/2018 8:13 PM, Leif Lindholm wrote:
>>> On Tue, Nov 20, 2018 at 05:01:46PM +0800, Ming Huang wrote:
>>>> Now that the generic Variable Runtime DXE code no longer
>>>> distinguishes between gEfiVariableGuid and
>>>> gEfiAuthenticatedVariableGuid in the varstore FV header.
>>>> We can relax the check in the flashFvb driver to accept
>>>> either GUID regardless of whether we are running a secure
>>>> boot capable build or not.
>>>
>>> We are still in a situation where D06 is not buildable with Secure
>>> Boot enabled though.
>>>
>>> If you build with -D SECURE_BOOT_ENABLE=TRUE, you still end up with
>>> /work/git/edk2-platforms/Platform/Hisilicon/D06/D06.dsc(...): error
>>> 4000: Instance of library class [PlatformSecureLib] is not found
>>>       in [/work/git/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf] [AARCH64]
>>>       consumed by module [/work/git/edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf]
>>>
>>> And all Hisilicon platforms still use
>>> AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
>>> regardless of Secure Boot setting.
>>>
>>> So what problem does this patch solve? A runtime one?
>>
>> This patch solve bug in FlashFvbDxe.
> 
> Yes, but what bug? What is the symptom? What _specific_ problem goes
> away by adding this patch? That information should have been in the
> original commit message. I have no information available to me as I
> now build -rc1 to suggest that this patch should be included.

The bug is that gEfiAuthenticatedVariableGuid should be used in FlashFvbDxe,
not gEfiVariableGuid when enable secure boot.

> 
>> Should I add a patch before this patch
>> to solve build error with -D SECURE_BOOT_ENABLE=TRUE in v4?
> 
> That would require a sane implementation of PlatformSecureLib,
> implementing a real UserPhysicalPresent().
> Can you turn that around within the next few hours?

My original idea is using OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.
There is not enough time to implement a real UserPhysicalPresent.
This patch will add when we implement real secure boot in future.

Thanks.

> 
> Regards,
> 
> Leif
> 
>> Thanks.
>>
>>>
>>> /
>>>     Leif
>>>
>>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>>> Signed-off-by: Ming Huang <ming.huang@linaro.org>
>>>> ---
>>>>  Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 1 +
>>>>  Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.c   | 5 +++--
>>>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
>>>> index f8be4741ef7c..a0226e0d87c0 100644
>>>> --- a/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
>>>> +++ b/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
>>>> @@ -44,6 +44,7 @@ [LibraryClasses]
>>>>    UefiRuntimeLib
>>>>  
>>>>  [Guids]
>>>> +  gEfiAuthenticatedVariableGuid
>>>>    gEfiSystemNvDataFvGuid
>>>>    gEfiVariableGuid
>>>>  
>>>> diff --git a/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.c b/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.c
>>>> index e18cc9e06ec2..12baed41cd4e 100644
>>>> --- a/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.c
>>>> +++ b/Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.c
>>>> @@ -189,7 +189,7 @@ InitializeFvAndVariableStoreHeaders (
>>>>      // VARIABLE_STORE_HEADER
>>>>      //
>>>>      VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)Headers + (UINTN)FirmwareVolumeHeader->HeaderLength);
>>>> -    CopyGuid (&VariableStoreHeader->Signature, &gEfiVariableGuid);
>>>> +    CopyGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid);
>>>>      VariableStoreHeader->Size = PcdGet32(PcdFlashNvStorageVariableSize) - FirmwareVolumeHeader->HeaderLength;
>>>>      VariableStoreHeader->Format            = VARIABLE_STORE_FORMATTED;
>>>>      VariableStoreHeader->State             = VARIABLE_STORE_HEALTHY;
>>>> @@ -258,7 +258,8 @@ ValidateFvHeader (
>>>>      VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)FwVolHeader + (UINTN)FwVolHeader->HeaderLength);
>>>>  
>>>>      // Check the Variable Store Guid
>>>> -    if ( CompareGuid (&VariableStoreHeader->Signature, &gEfiVariableGuid) == FALSE )
>>>> +    if (!CompareGuid (&VariableStoreHeader->Signature, &gEfiVariableGuid) &&
>>>> +        !CompareGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid))
>>>>      {
>>>>          DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Variable Store Guid non-compatible\n"));
>>>>          return EFI_NOT_FOUND;
>>>> -- 
>>>> 2.9.5
>>>>


  reply	other threads:[~2018-11-20 14:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20  9:01 [PATCH edk2-platforms v3 0/5] Fix D06 SBSA/SBBR issue and improve Ming Huang
2018-11-20  9:01 ` [PATCH edk2-platforms v3 1/5] Hisilicon/D0x: Fix secure boot bug in FlashFvbDxe Ming Huang
2018-11-20 12:13   ` Leif Lindholm
2018-11-20 12:40     ` Ming Huang
2018-11-20 12:58       ` Leif Lindholm
2018-11-20 14:29         ` Ming Huang [this message]
2018-11-20 14:39           ` Leif Lindholm
2018-11-20 15:00             ` Ming Huang
2018-11-20 15:20               ` Laszlo Ersek
2018-11-20 16:23               ` Leif Lindholm
2018-11-21  7:42             ` Ming Huang
2018-11-20 14:40           ` Ard Biesheuvel
2018-11-20 15:14             ` Laszlo Ersek
2018-11-20  9:01 ` [PATCH edk2-platforms v3 2/5] Hisilicon/D06: Modify Gic base Ming Huang
2018-11-20  9:01 ` [PATCH edk2-platforms v3 3/5] Hisilicon/D06: Correct PcdGicInterruptInterfaceBase Ming Huang
2018-11-20  9:01 ` [PATCH edk2-platforms v3 4/5] Silicon/Hisilicon/D06: Set TA as Node 0 for TA boot Ming Huang
2019-02-11 14:45   ` Leif Lindholm
2018-11-20  9:01 ` [PATCH edk2-platforms v3 5/5] Hisilicon/D06: Move some functions to OemMiscLib Ming Huang
2018-11-20 13:02 ` [PATCH edk2-platforms v3 0/5] Fix D06 SBSA/SBBR issue and improve Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e4db632-9c2c-79e0-2bbe-cdc7913aa0c5@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox