From: "gaoliming" <gaoliming@byosoft.com.cn>
To: "'Zhihao Li'" <zhihao.li@intel.com>, <devel@edk2.groups.io>,
"'Ni, Ray'" <ray.ni@intel.com>, <kraxel@redhat.com>
Cc: "'Jian J Wang'" <jian.j.wang@intel.com>
Subject: 回复: [PATCH v1 1/1] MdeModulePkg/VariableSmm.c: add Ap rendezvous check before SmmSetVariable.
Date: Thu, 18 May 2023 17:37:30 +0800 [thread overview]
Message-ID: <05b701d9896c$5df57160$19e05420$@byosoft.com.cn> (raw)
In-Reply-To: <20230510105653.635-1-zhihao.li@intel.com>
Zhihao:
Have you root cause this issue that SmmVariableSetVariable may return
EFI_ACCESS_DENIED?
I am not sure whether this fix is proper. I also add UefiCpuPkg
maintainers Ray and Gerd in the mail loop for this discussion.
Thanks
Liming
> -----邮件原件-----
> 发件人: Zhihao Li <zhihao.li@intel.com>
> 发送时间: 2023年5月10日 18:57
> 收件人: devel@edk2.groups.io
> 抄送: Jian J Wang <jian.j.wang@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>
> 主题: [PATCH v1 1/1] MdeModulePkg/VariableSmm.c: add Ap rendezvous
> check before SmmSetVariable.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4429
>
> For Ap-Relaxed sync mode, SmmVariableSetVariable() need to let all Aps
> arrive to smm before it set the variable. If not, it would return
> EFI_ACCESS_DENIED.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>
> Signed-off-by: Zhihao Li <zhihao.li@intel.com>
> ---
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
> | 10 +++++++++-
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
> | 3 ++-
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf
> | 3 ++-
> 3 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
> b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
> index 5253c328dcd9..4944903e64d4 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
> @@ -14,7 +14,7 @@
> VariableServiceSetVariable(), VariableServiceQueryVariableInfo(),
> ReclaimForOS(),
>
> SmmVariableGetStatistics() should also do validation based on its own
> knowledge.
>
>
>
> -Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
>
> +Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.<BR>
>
> Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
> #include <Library/MmServicesTableLib.h>
>
> #include <Library/VariablePolicyLib.h>
>
> +#include <Library/SmmCpuRendezvousLib.h>
>
>
>
> #include <Guid/SmmVariableCommon.h>
>
> #include "Variable.h"
>
> @@ -87,6 +88,13 @@ SmmVariableSetVariable (
> {
>
> EFI_STATUS Status;
>
>
>
> + //
>
> + // Need to wait for all Aps to arrive in Relaxed-AP Sync Mode
>
> + //
>
> + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) {
>
> + DEBUG ((DEBUG_ERROR, "SetVariable: fail to wait for all AP check in
> SMM!\n"));
>
> + }
>
> +
>
> //
>
> // Disable write protection when the calling SetVariable() through
> EFI_SMM_VARIABLE_PROTOCOL.
>
> //
>
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
> b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
> index 8c552b87e080..1cf0d051e6c9 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
> @@ -18,7 +18,7 @@
> # may not be modified without authorization. If platform fails to
protect
> these resources,
>
> # the authentication service provided in this driver will be broken, and
the
> behavior is undefined.
>
> #
>
> -# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
>
> +# Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.<BR>
>
> # Copyright (c) Microsoft Corporation.
>
> # SPDX-License-Identifier: BSD-2-Clause-Patent
>
> #
>
> @@ -84,6 +84,7 @@
> VariablePolicyLib
>
> VariablePolicyHelperLib
>
> SafeIntLib
>
> + SmmCpuRendezvousLib
>
>
>
> [Protocols]
>
> gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES
>
> diff --git
> a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in
> f
> b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in
> f
> index f09bed40cf51..89187456ca25 100644
> ---
> a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in
> f
> +++
> b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in
> f
> @@ -18,7 +18,7 @@
> # may not be modified without authorization. If platform fails to
protect
> these resources,
>
> # the authentication service provided in this driver will be broken, and
the
> behavior is undefined.
>
> #
>
> -# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
>
> +# Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.<BR>
>
> # Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
>
> # Copyright (c) Microsoft Corporation.
>
> # SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -80,6 +80,7 @@
> VariableFlashInfoLib
>
> VariablePolicyLib
>
> VariablePolicyHelperLib
>
> + SmmCpuRendezvousLib
>
>
>
> [Protocols]
>
> gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES
>
> --
> 2.26.2.windows.1
next prev parent reply other threads:[~2023-05-18 9:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 10:56 [PATCH v1 1/1] MdeModulePkg/VariableSmm.c: add Ap rendezvous check before SmmSetVariable Li, Zhihao
2023-05-18 9:37 ` gaoliming [this message]
2023-05-19 8:11 ` Li, Zhihao
2023-05-19 9:00 ` 回复: " gaoliming
2023-06-01 1:02 ` [edk2-devel] " Wu, Jiaxin
2023-06-01 1:06 ` Yao, Jiewen
2023-06-01 1:07 ` Ni, Ray
2023-06-01 1:09 ` Wu, Jiaxin
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='05b701d9896c$5df57160$19e05420$@byosoft.com.cn' \
--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