public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 02/12] MdeModulePkg: Define the VariablePolicyLib
Date: Tue, 12 May 2020 13:43:19 +0200	[thread overview]
Message-ID: <7b36b87c-e9e5-b6cc-a43a-88a0a009bd4c@redhat.com> (raw)
In-Reply-To: <MWHPR07MB3440B4B5CBBEF97668867253E9BE0@MWHPR07MB3440.namprd07.prod.outlook.com>

On 05/12/20 08:46, Michael Kubacki wrote:
> From: Bret Barkelew <brbarkel@microsoft.com>
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=2522
>
> VariablePolicy is an updated interface to
> replace VarLock and VarCheckProtocol.
>
> Add the VariablePolicyLib library that implements
> the portable business logic for the VariablePolicy
> engine.
>
> Also add host-based CI test cases for the lib.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c                     |   46 +
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c               |   85 +
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c                               |  806 +++++++
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c   | 2285 ++++++++++++++++++++
>  MdeModulePkg/Include/Library/VariablePolicyLib.h                                         |  207 ++
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf                             |   44 +
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.uni                             |   12 +
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf                   |   52 +
>  MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.inf |   41 +
>  MdeModulePkg/MdeModulePkg.dec                                                            |    3 +
>  MdeModulePkg/MdeModulePkg.dsc                                                            |    5 +
>  MdeModulePkg/Test/MdeModulePkgHostTest.dsc                                               |   11 +
>  12 files changed, 3597 insertions(+)
>
> diff --git a/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c
> new file mode 100644
> index 000000000000..ad2ee0b2fb8f
> --- /dev/null
> +++ b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitNull.c
> @@ -0,0 +1,46 @@
> +/** @file -- VariablePolicyExtraInitNull.c
> +This file contains extra init and deinit routines that don't do anything
> +extra.
> +
> +Copyright (c) Microsoft Corporation.
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Library/UefiRuntimeServicesTableLib.h>
> +
> +
> +/**
> +  An extra init hook that enables the RuntimeDxe library instance to
> +  register VirtualAddress change callbacks. Among other things.
> +
> +  @retval     EFI_SUCCESS   Everything is good. Continue with init.
> +  @retval     Others        Uh... don't continue.
> +
> +**/
> +EFI_STATUS
> +VariablePolicyExtraInit (
> +  VOID
> +  )
> +{
> +  // NULL implementation.
> +  return EFI_SUCCESS;
> +}
> +
> +
> +/**
> +  An extra deinit hook that enables the RuntimeDxe library instance to
> +  register VirtualAddress change callbacks. Among other things.
> +
> +  @retval     EFI_SUCCESS   Everything is good. Continue with deinit.
> +  @retval     Others        Uh... don't continue.
> +
> +**/
> +EFI_STATUS
> +VariablePolicyExtraDeinit (
> +  VOID
> +  )
> +{
> +  // NULL implementation.
> +  return EFI_SUCCESS;
> +}
> diff --git a/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c
> new file mode 100644
> index 000000000000..8e63f4eb66a0
> --- /dev/null
> +++ b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c
> @@ -0,0 +1,85 @@
> +/** @file -- VariablePolicyExtraInitRuntimeDxe.c
> +This file contains extra init and deinit routines that register and unregister
> +VariableAddressChange callbacks.
> +
> +Copyright (c) Microsoft Corporation.
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiRuntimeServicesTableLib.h>
> +
> +extern EFI_GET_VARIABLE   mGetVariableHelper = NULL;
> +extern UINT8              *mPolicyTable = NULL;

These two lines trigger a build failure with GCC48:

> MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c:13:27: error: 'mGetVariableHelper' initialized and declared 'extern' [-Werror]
>  extern EFI_GET_VARIABLE   mGetVariableHelper = NULL;
>                            ^
> MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c:14:28: error: 'mPolicyTable' initialized and declared 'extern' [-Werror]
>  extern UINT8              *mPolicyTable = NULL;
>                             ^
> cc1: all warnings being treated as errors

Unfortunately, this is a gcc bug:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45977

More precisely, it is not a bug that gcc "warns" about this (it *would* be a
gcc bug no-questions-asked if the diagnostic would be a hard error even without
"-Werror").

Instead, the gcc bug at present is that gcc doesn't offer a
"-Wno-error=FOOBAR"-style option for disabling "error treatment" for this
specific warning.

So please rework this in order to avoid triggering the gcc problem.

Thanks!
Laszlo


  reply	other threads:[~2020-05-12 11:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200512064635.14640-1-michael.kubacki@outlook.com>
2020-05-12  6:46 ` [PATCH v2 01/12] MdeModulePkg: Define the VariablePolicy protocol interface Michael Kubacki
2020-05-12 12:19   ` [edk2-devel] " Laszlo Ersek
2020-05-13  4:51     ` [EXTERNAL] " Bret Barkelew
2020-05-13 10:10       ` Laszlo Ersek
2020-05-12  6:46 ` [PATCH v2 02/12] MdeModulePkg: Define the VariablePolicyLib Michael Kubacki
2020-05-12 11:43   ` Laszlo Ersek [this message]
2020-05-12  6:46 ` [PATCH v2 03/12] MdeModulePkg: Define the VariablePolicyHelperLib Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 04/12] MdeModulePkg: Define the VarCheckPolicyLib and SMM interface Michael Kubacki
2020-05-12 12:26   ` [edk2-devel] " Laszlo Ersek
2020-05-12 13:37     ` Liming Gao
2020-05-12  6:46 ` [PATCH v2 05/12] MdeModulePkg: Connect VariablePolicy business logic to VariableServices Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 06/12] MdeModulePkg: Allow VariablePolicy state to delete protected variables Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 07/12] SecurityPkg: Allow VariablePolicy state to delete authenticated variables Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 08/12] MdeModulePkg: Change TCG MOR variables to use VariablePolicy Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 09/12] MdeModulePkg: Drop VarLock from RuntimeDxe variable driver Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 10/12] MdeModulePkg: Add a shell-based functional test for VariablePolicy Michael Kubacki
2020-05-12  6:46 ` [PATCH v2 11/12] OvmfPkg: Add VariablePolicy engine to OvmfPkg platform Michael Kubacki
2020-05-12 12:05   ` [edk2-devel] " Laszlo Ersek
2020-05-12  6:46 ` [PATCH v2 12/12] EmulatorPkg: Add VariablePolicy engine to EmulatorPkg platform Michael Kubacki

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=7b36b87c-e9e5-b6cc-a43a-88a0a009bd4c@redhat.com \
    --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