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.web08.61059.1638839530035912590 for ; Mon, 06 Dec 2021 17:12:10 -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, 07 Dec 2021 09:12:06 +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: "'Kun Qin'" , "'Ard Biesheuvel'" Cc: "'edk2-devel-groups-io'" , "'Jian J Wang'" , "'Hao A Wu'" , "'Leif Lindholm'" , "'Ard Biesheuvel'" , "'Bret Barkelew'" , "'Michael Kubacki'" References: <16BC2C06E438B403.26361@groups.io> <6fcb7f10-c113-1c9d-2b4d-264b81ed6ad1@gmail.com> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDAvMl0gTU0gY29tbXVuaWNhdGUgZnVuY3Rpb25hbGl0eSBpbiB2YXJpYWJsZSBwb2xpY3k=?= Date: Tue, 7 Dec 2021 09:12:07 +0800 Message-ID: <02f401d7eb07$746d7d70$5d487850$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIwMwQlW5mS1uCouU/BQ3Lx5kzXKQIT0ZfIAbbzWfcB9fYXK6tHoiMQ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Kun: Does this change impact current behavior? Seemly, there is no strict = check on MessageLength. Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Kun Qin > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: = 2021=E5=B9=B412=E6=9C=887=E6=97=A5 2:47 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Ard Biesheuvel > =E6=8A=84=E9=80=81: edk2-devel-groups-io ; Jian = J Wang > ; Liming Gao ; Hao A > Wu ; Leif Lindholm ; Ard > Biesheuvel ; Bret Barkelew > ; Michael Kubacki > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH v1 0/2] MM communicate = functionality in > variable policy >=20 > Thanks for the information, Ard. I just meant to plan ahead so that I > can work on the feedback for these patches, if any. >=20 > I can ping back the thread again once the stable tag is created. >=20 > Regards, > Kun >=20 > On 12/06/2021 10:41, Ard Biesheuvel wrote: > > On Mon, 6 Dec 2021 at 19:35, Kun Qin wrote: > >> > >> Hi ArmPkg and MdeModulePkg maintainers, > >> > >> It has been a week since the patches were sent. Could you please = review > >> the changes and let me know if there is any feedback? Any input is > >> appreciated. > >> > > > > As far as I know, we are still in hard freeze for the upcoming = stable tag. > > > >> > >> On 11/29/2021 16:39, Kun Qin via groups.io wrote: > >>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3709 > >>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3751 > >>> > >>> Currently, setups with variable policy operations used together = with MM > >>> communicate from ArmPkg could fail with `EFI_INVALID_PARAMETER`. > This was > >>> due to the errors from 2 following aspects: > >>> > >>> 1. For variable policy implementations in MdeModulePkg, the DXE > runtime > >>> agent would communicate to MM to disable, register or query = policies. > >>> However, during these operations, the MessageLength calculation is > >>> including MM communicate header. This could lead to MM agent read > data > >>> across the given buffer boundary and/or trigger other errors. > >>> > >>> 2. On the other hand, current MM communicate routine from ArmPkg > would > >>> fail the function if the input message length does not equal to = input > >>> buffer size. > >>> > >>> As defined in PI specification, the `CommSize`, when as input, = should > >>> stand for "The size of the data buffer being passed in", which = would mean > >>> the maximal number of bytes `CommBuffer` can hold. In turn, the = value of > >>> this input parameter can be used for MM handlers to determine = whether > the > >>> output data is too large to fit in this buffer. Enforcing the = incoming > >>> buffer to hold exactly the number of used bytes mismatches with = the PI > >>> spec description. > >>> > >>> This change fix MessageLength field calculation from variable = policy and > >>> updated input argument inspections from MM communicate routine in > ArmPkg > >>> to match PI spec descriptions. > >>> > >>> Patch v1 branch: > https://github.com/kuqin12/edk2/tree/mm_communicate_check > >>> > >>> Cc: Jian J Wang > >>> Cc: Liming Gao > >>> Cc: Hao A Wu > >>> Cc: Leif Lindholm > >>> Cc: Ard Biesheuvel > >>> Cc: Bret Barkelew > >>> Cc: Michael Kubacki > >>> > >>> Kun Qin (2): > >>> MdeModulePkg: VariableSmmRuntimeDxe: Fix Variable Policy > Message > >>> Length > >>> ArmPkg: MmCommunicationDxe: Update MM communicate input > arguments > >>> checks > >>> > >>> ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > | 44 ++++++++++++-------- > >>> > MdeModulePkg/Universal/Variable/RuntimeDxe/VariablePolicySmmDxe.c | > 10 ++--- > >>> 2 files changed, 32 insertions(+), 22 deletions(-) > >>>