From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web09.311.1641863916725027113 for ; Mon, 10 Jan 2022 17:18:38 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 11 Jan 2022 09:18:28 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Jian J Wang'" , "'Hao A Wu'" , "'Bret Barkelew'" , "'Michael Kubacki'" References: <20211221013334.1751-1-kuqin12@gmail.com> <20211221013334.1751-2-kuqin12@gmail.com> In-Reply-To: <20211221013334.1751-2-kuqin12@gmail.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYyIDEvNl0gTWRlTW9kdWxlUGtnOiBWYXJpYWJsZVNtbVJ1bnRpbWVEeGU6IEZpeCBWYXJpYWJsZSBQb2xpY3kgTWVzc2FnZSBMZW5ndGg=?= Date: Tue, 11 Jan 2022 09:18:32 +0800 Message-ID: <01c801d80689$2653ec30$72fbc490$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIUAYUh7ldOkiYheACRm4943XQaNQDu2rl5q92YWDA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Kun Qin > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA12=D4=C221=C8=D5 9:33 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Jian J Wang ; Liming Gao > ; Hao A Wu ; Bret > Barkelew ; Michael Kubacki > > =D6=F7=CC=E2: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: VariableSmmRuntim= eDxe: > Fix Variable Policy Message Length >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3709 >=20 > In EDKII implementation of variable policy, the DXE runtime agent would > communicate to MM to disable, register or query policies. However, these > operations populate the value of MessageLength that includes communicate > header to include MM communicate header, which mismatches with the > description of PI specification. >=20 > This fix will correct the MessageLength field calculation to exclude > the size of MM_COMMUNICATE_HEADER. >=20 > Cc: Jian J Wang > Cc: Liming Gao > Cc: Hao A Wu > Cc: Bret Barkelew > Cc: Michael Kubacki >=20 > Signed-off-by: Kun Qin > --- >=20 > Notes: > v2: > - No review, no updates >=20 > MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c | > 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c > index 672a2293bcb1..b2094fbcd6ea 100644 > --- > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c > @@ -89,7 +89,7 @@ ProtocolDisableVariablePolicy ( > CommHeader =3D mMmCommunicationBuffer; > PolicyHeader =3D (VAR_CHECK_POLICY_COMM_HEADER > *)&CommHeader->Data; > CopyGuid (&CommHeader->HeaderGuid, > &gVarCheckPolicyLibMmiHandlerGuid); > - CommHeader->MessageLength =3D BufferSize; > + CommHeader->MessageLength =3D BufferSize - OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > PolicyHeader->Signature =3D VAR_CHECK_POLICY_COMM_SIG; > PolicyHeader->Revision =3D VAR_CHECK_POLICY_COMM_REVISION; > PolicyHeader->Command =3D > VAR_CHECK_POLICY_COMMAND_DISABLE; > @@ -138,7 +138,7 @@ ProtocolIsVariablePolicyEnabled ( > PolicyHeader =3D (VAR_CHECK_POLICY_COMM_HEADER > *)&CommHeader->Data; > CommandParams =3D (VAR_CHECK_POLICY_COMM_IS_ENABLED_PARAMS > *)(PolicyHeader + 1); > CopyGuid (&CommHeader->HeaderGuid, > &gVarCheckPolicyLibMmiHandlerGuid); > - CommHeader->MessageLength =3D BufferSize; > + CommHeader->MessageLength =3D BufferSize - OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > PolicyHeader->Signature =3D VAR_CHECK_POLICY_COMM_SIG; > PolicyHeader->Revision =3D VAR_CHECK_POLICY_COMM_REVISION; > PolicyHeader->Command =3D > VAR_CHECK_POLICY_COMMAND_IS_ENABLED; > @@ -213,7 +213,7 @@ ProtocolRegisterVariablePolicy ( > PolicyHeader =3D (VAR_CHECK_POLICY_COMM_HEADER > *)&CommHeader->Data; > PolicyBuffer =3D (VOID *)(PolicyHeader + 1); > CopyGuid (&CommHeader->HeaderGuid, > &gVarCheckPolicyLibMmiHandlerGuid); > - CommHeader->MessageLength =3D BufferSize; > + CommHeader->MessageLength =3D BufferSize - OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > PolicyHeader->Signature =3D VAR_CHECK_POLICY_COMM_SIG; > PolicyHeader->Revision =3D VAR_CHECK_POLICY_COMM_REVISION; > PolicyHeader->Command =3D > VAR_CHECK_POLICY_COMMAND_REGISTER; > @@ -270,7 +270,7 @@ DumpVariablePolicyHelper ( > PolicyHeader =3D (VAR_CHECK_POLICY_COMM_HEADER > *)&CommHeader->Data; > CommandParams =3D (VAR_CHECK_POLICY_COMM_DUMP_PARAMS > *)(PolicyHeader + 1); > CopyGuid (&CommHeader->HeaderGuid, > &gVarCheckPolicyLibMmiHandlerGuid); > - CommHeader->MessageLength =3D BufferSize; > + CommHeader->MessageLength =3D BufferSize - OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > PolicyHeader->Signature =3D VAR_CHECK_POLICY_COMM_SIG; > PolicyHeader->Revision =3D VAR_CHECK_POLICY_COMM_REVISION; > PolicyHeader->Command =3D > VAR_CHECK_POLICY_COMMAND_DUMP; > @@ -397,7 +397,7 @@ ProtocolLockVariablePolicy ( > CommHeader =3D mMmCommunicationBuffer; > PolicyHeader =3D (VAR_CHECK_POLICY_COMM_HEADER > *)&CommHeader->Data; > CopyGuid (&CommHeader->HeaderGuid, > &gVarCheckPolicyLibMmiHandlerGuid); > - CommHeader->MessageLength =3D BufferSize; > + CommHeader->MessageLength =3D BufferSize - OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > PolicyHeader->Signature =3D VAR_CHECK_POLICY_COMM_SIG; > PolicyHeader->Revision =3D VAR_CHECK_POLICY_COMM_REVISION; > PolicyHeader->Command =3D > VAR_CHECK_POLICY_COMMAND_LOCK; > -- > 2.32.0.windows.1 >=20 >=20 >=20 >=20 >=20