public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Zeng, Star" <star.zeng@intel.com>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	 Ladi Prosek <lprosek@redhat.com>
Subject: Re: [PATCH 2/6] MdeModulePkg/Variable/RuntimeDxe: move MOR func. declarations to header
Date: Mon, 9 Oct 2017 14:47:44 +0200	[thread overview]
Message-ID: <326d53e9-e615-f7ff-c52f-a1760d9c76dc@redhat.com> (raw)
In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B97F2D1@shsmsx102.ccr.corp.intel.com>

On 10/09/17 08:55, Zeng, Star wrote:
> Minor comment:
> 
> How about also to fix the comment for Attributes parameter of SetVariableCheckHandlerMor() like below?
> 
>   @param[in]  Attributes         Attributes bitmask to set for the variable.

Right, I can do that.

Thanks!
Laszlo

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com] 
> Sent: Wednesday, October 4, 2017 5:29 AM
> To: edk2-devel-01 <edk2-devel@lists.01.org>
> Cc: Dong, Eric <eric.dong@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ladi Prosek <lprosek@redhat.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH 2/6] MdeModulePkg/Variable/RuntimeDxe: move MOR func. declarations to header
> 
> The MorLockInit() and SetVariableCheckHandlerMor() functions have separate implementations for VariableRuntimeDxe (= unprivileged, unified DXE_RUNTIME driver) and VariableSmm (= privileged, DXE_SMM back-end of the split variable driver).
> 
> Move their declarations from "Variable.c" to "PrivilegePolymorphic.h", so that the compiler enforce that the declarations and the definitions match.
> (All C source files with the call sites and the function definitions already include "PrivilegePolymorphic.h" via "Variable.h".)
> 
> At the same time:
> 
> - replace two typos in the MorLockInit() description:
>   - replace "EFI_SUCEESS" with "EFI_SUCCESS",
>   - replace "MOR Lock Control" with "MOR Control Lock";
> 
> - in the SetVariableCheckHandlerMor() description:
>   - replace @param with @param[in],
>   - rewrap the comment to 80 columns.
> 
> This change cleans up commit 2f6aa774fe38 ("MdeModulePkg: Add MorLock to variable driver.", 2016-01-19).
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Ladi Prosek <lprosek@redhat.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h | 41 ++++++++++++++++++++
>  MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c        | 30 +++++++-------
>  MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c        | 30 +++++++-------
>  MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c             | 37 ------------------
>  4 files changed, 75 insertions(+), 63 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h
> index 0aa0d4f48f10..1118f4b52e49 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h
> @@ -35,4 +35,45 @@ SecureBootHook (
>    IN EFI_GUID                               *VendorGuid
>    );
>  
> +/**
> +  Initialization for MOR Control Lock.
> +
> +  @retval EFI_SUCCESS     MorLock initialization success.
> +  @return Others          Some error occurs.
> +**/
> +EFI_STATUS
> +MorLockInit (
> +  VOID
> +  );
> +
> +/**
> +  This service is an MOR/MorLock checker handler for the SetVariable().
> +
> +  @param[in]  VariableName the name of the vendor's variable, as a
> +                           Null-Terminated Unicode String
> +  @param[in]  VendorGuid   Unify identifier for vendor.
> +  @param[in]  Attributes   Point to memory location to return the attributes of
> +                           variable. If the point is NULL, the parameter would
> +                           be ignored.
> +  @param[in]  DataSize     The size in bytes of Data-Buffer.
> +  @param[in]  Data         Point to the content of the variable.
> +
> +  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable
> +                                  driver can store the variable data.
> +  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or
> +                                  attributes is not allowed for MOR variable.
> +  @retval  EFI_ACCESS_DENIED      The MOR/MorLock is locked.
> +  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this
> +                                  function. Variable driver can just return
> +                                  EFI_SUCCESS.
> +**/
> +EFI_STATUS
> +SetVariableCheckHandlerMor (
> +  IN CHAR16     *VariableName,
> +  IN EFI_GUID   *VendorGuid,
> +  IN UINT32     Attributes,
> +  IN UINTN      DataSize,
> +  IN VOID       *Data
> +  );
> +
>  #endif
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c
> index c32eb3b1ac4b..ab3e5d416cd4 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c
> @@ -28,19 +28,23 @@ extern EDKII_VARIABLE_LOCK_PROTOCOL     mVariableLock;
>  /**
>    This service is an MOR/MorLock checker handler for the SetVariable().
>  
> -  @param  VariableName the name of the vendor's variable, as a
> -                       Null-Terminated Unicode String
> -  @param  VendorGuid   Unify identifier for vendor.
> -  @param  Attributes   Point to memory location to return the attributes of variable. If the point
> -                       is NULL, the parameter would be ignored.
> -  @param  DataSize     The size in bytes of Data-Buffer.
> -  @param  Data         Point to the content of the variable.
> +  @param[in]  VariableName the name of the vendor's variable, as a
> +                           Null-Terminated Unicode String
> +  @param[in]  VendorGuid   Unify identifier for vendor.
> +  @param[in]  Attributes   Point to memory location to return the attributes of
> +                           variable. If the point is NULL, the parameter would
> +                           be ignored.
> +  @param[in]  DataSize     The size in bytes of Data-Buffer.
> +  @param[in]  Data         Point to the content of the variable.
>  
> -  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable driver can store the variable data.
> -  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or attributes is not allowed for MOR variable.
> +  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable
> +                                  driver can store the variable data.
> +  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or
> +                                  attributes is not allowed for MOR variable.
>    @retval  EFI_ACCESS_DENIED      The MOR/MorLock is locked.
> -  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this function.
> -                                  Variable driver can just return EFI_SUCCESS.
> +  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this
> +                                  function. Variable driver can just return
> +                                  EFI_SUCCESS.
>  **/
>  EFI_STATUS
>  SetVariableCheckHandlerMor (
> @@ -58,9 +62,9 @@ SetVariableCheckHandlerMor (  }
>  
>  /**
> -  Initialization for MOR Lock Control.
> +  Initialization for MOR Control Lock.
>  
> -  @retval EFI_SUCEESS     MorLock initialization success.
> +  @retval EFI_SUCCESS     MorLock initialization success.
>    @return Others          Some error occurs.
>  **/
>  EFI_STATUS
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c
> index d06317ca9cf4..390c8fde4bd4 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c
> @@ -309,19 +309,23 @@ SetVariableCheckHandlerMorLock (
>  /**
>    This service is an MOR/MorLock checker handler for the SetVariable().
>  
> -  @param  VariableName the name of the vendor's variable, as a
> -                       Null-Terminated Unicode String
> -  @param  VendorGuid   Unify identifier for vendor.
> -  @param  Attributes   Point to memory location to return the attributes of variable. If the point
> -                       is NULL, the parameter would be ignored.
> -  @param  DataSize     The size in bytes of Data-Buffer.
> -  @param  Data         Point to the content of the variable.
> +  @param[in]  VariableName the name of the vendor's variable, as a
> +                           Null-Terminated Unicode String
> +  @param[in]  VendorGuid   Unify identifier for vendor.
> +  @param[in]  Attributes   Point to memory location to return the attributes of
> +                           variable. If the point is NULL, the parameter would
> +                           be ignored.
> +  @param[in]  DataSize     The size in bytes of Data-Buffer.
> +  @param[in]  Data         Point to the content of the variable.
>  
> -  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable driver can store the variable data.
> -  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or attributes is not allowed for MOR variable.
> +  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable
> +                                  driver can store the variable data.
> +  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or
> +                                  attributes is not allowed for MOR variable.
>    @retval  EFI_ACCESS_DENIED      The MOR/MorLock is locked.
> -  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this function.
> -                                  Variable driver can just return EFI_SUCCESS.
> +  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this
> +                                  function. Variable driver can just return
> +                                  EFI_SUCCESS.
>  **/
>  EFI_STATUS
>  SetVariableCheckHandlerMor (
> @@ -377,9 +381,9 @@ SetVariableCheckHandlerMor (  }
>  
>  /**
> -  Initialization for MOR Lock Control.
> +  Initialization for MOR Control Lock.
>  
> -  @retval EFI_SUCEESS     MorLock initialization success.
> +  @retval EFI_SUCCESS     MorLock initialization success.
>    @return Others          Some error occurs.
>  **/
>  EFI_STATUS
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> index 28e4ac8f3819..d68dfbe648ce 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> @@ -97,43 +97,6 @@ AUTH_VAR_LIB_CONTEXT_IN mAuthContextIn = {
>  
>  AUTH_VAR_LIB_CONTEXT_OUT mAuthContextOut;
>  
> -/**
> -  Initialization for MOR Lock Control.
> -
> -  @retval EFI_SUCEESS     MorLock initialization success.
> -  @return Others          Some error occurs.
> -**/
> -EFI_STATUS
> -MorLockInit (
> -  VOID
> -  );
> -
> -/**
> -  This service is an MOR/MorLock checker handler for the SetVariable().
> -
> -  @param  VariableName the name of the vendor's variable, as a
> -                       Null-Terminated Unicode String
> -  @param  VendorGuid   Unify identifier for vendor.
> -  @param  Attributes   Point to memory location to return the attributes of variable. If the point
> -                       is NULL, the parameter would be ignored.
> -  @param  DataSize     The size in bytes of Data-Buffer.
> -  @param  Data         Point to the content of the variable.
> -
> -  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable driver can store the variable data.
> -  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or attributes is not allowed for MOR variable.
> -  @retval  EFI_ACCESS_DENIED      The MOR/MorLock is locked.
> -  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this function.
> -                                  Variable driver can just return EFI_SUCCESS.
> -**/
> -EFI_STATUS
> -SetVariableCheckHandlerMor (
> -  IN CHAR16     *VariableName,
> -  IN EFI_GUID   *VendorGuid,
> -  IN UINT32     Attributes,
> -  IN UINTN      DataSize,
> -  IN VOID       *Data
> -  );
> -
>  /**
>    Routine used to track statistical information about variable usage.
>    The data is stored in the EFI system table so it can be accessed later.
> --
> 2.14.1.3.gb7cf6e02401b
> 
> 



  reply	other threads:[~2017-10-09 12:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 21:28 [PATCH 0/6] MdeModulePkg/VariableSmm: fix MOR / MorLock inconsistency Laszlo Ersek
2017-10-03 21:28 ` [PATCH 1/6] MdeModulePkg/Variable/RuntimeDxe: move SecureBootHook() decl to new header Laszlo Ersek
2017-10-03 21:28 ` [PATCH 2/6] MdeModulePkg/Variable/RuntimeDxe: move MOR func. declarations to header Laszlo Ersek
2017-10-09  6:55   ` Zeng, Star
2017-10-09 12:47     ` Laszlo Ersek [this message]
2017-10-03 21:28 ` [PATCH 3/6] MdeModulePkg/Variable/RuntimeDxe: introduce MorLockInitAtEndOfDxe() hook Laszlo Ersek
2017-10-03 21:28 ` [PATCH 4/6] MdeModulePkg/Variable/RuntimeDxe: permit MorLock deletion for passthru req Laszlo Ersek
2017-10-03 21:28 ` [PATCH 5/6] MdeModulePkg/Variable/RuntimeDxe: delay MorLock creation until EndOfDxe Laszlo Ersek
2017-10-03 21:28 ` [PATCH 6/6] MdeModulePkg/Variable/RuntimeDxe: delete and lock OS-created MOR variable Laszlo Ersek
2017-10-09  7:12   ` Zeng, Star
2017-10-09 15:20     ` Laszlo Ersek
2017-10-10  4:15       ` Yao, Jiewen
2017-10-10 13:14         ` Zeng, Star
2017-10-04  1:18 ` [PATCH 0/6] MdeModulePkg/VariableSmm: fix MOR / MorLock inconsistency Yao, Jiewen
2017-10-04 10:39   ` Laszlo Ersek
2017-10-04 12:24     ` Ladi Prosek
2017-10-10  4:17     ` Yao, Jiewen
2017-10-10 10:09       ` Laszlo Ersek
2017-10-10 12:16         ` Zeng, Star
2017-10-05  7:42 ` Zeng, Star
2017-10-05  7:57   ` Laszlo Ersek
2017-10-05  9:12     ` Yao, Jiewen

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=326d53e9-e615-f7ff-c52f-a1760d9c76dc@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