From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AE6FC820FC for ; Sun, 11 Dec 2016 17:10:23 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 11 Dec 2016 17:10:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,334,1477983600"; d="scan'208";a="39088674" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 11 Dec 2016 17:10:23 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 11 Dec 2016 17:10:22 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 11 Dec 2016 17:10:22 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.9]) by shsmsx102.ccr.corp.intel.com ([169.254.2.54]) with mapi id 14.03.0248.002; Mon, 12 Dec 2016 09:10:19 +0800 From: "Yao, Jiewen" To: "edk2-devel@lists.01.org" CC: "Fan, Jeff" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg VariableSmm: Do not need check CommBufferSize buffer Thread-Index: AQHSUej4kNqswMGUL0egJFEtt4x58KEC/s6AgACGNqA= Date: Mon, 12 Dec 2016 01:10:18 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A8B9898@SHSMSX104.ccr.corp.intel.com> References: <1481266396-180280-1-git-send-email-star.zeng@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B7AA442@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B7AA442@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg VariableSmm: Do not need check CommBufferSize buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Dec 2016 01:10:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of St= ar > Zeng > Sent: Friday, December 9, 2016 2:53 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Fan, Jeff ; Z= eng, > Star > Subject: [edk2] [PATCH] MdeModulePkg VariableSmm: Do not need check > CommBufferSize buffer >=20 > Current code in SmmVariableHandler() checks CommBufferSize buffer to make > sure it points to outside SMRAM in "case > SMM_VARIABLE_FUNCTION_GET_STATISTICS". >=20 > But after eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd, > CommBufferSize buffer points to SMRAM that was used by SMM core to cache > CommSize from SmmCommunication protocol, then the check will fail definit= ely > and GET_STATISTICS feature breaks. >=20 > In fact, do not need check CommBufferSize buffer at all even before > eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd. > Before eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd, > CommBufferSize buffer pointed to gSmmCorePrivate->BufferSize that is outs= ide > SMRAM, the check will success definitely; after > eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd, > CommBufferSize buffer points to local variable BufferSize (in SMRAM) in > SmmEntryPoint(), the check is not needed definitely. >=20 > The patch is to remove the check. >=20 > Cc: Jiewen Yao > Cc: Jeff Fan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > index eafb53322e8c..c714916019ef 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > @@ -695,11 +695,10 @@ SmmVariableHandler ( > // It is covered by previous CommBuffer check > // >=20 > - if (!SmmIsBufferOutsideSmmValid > ((EFI_PHYSICAL_ADDRESS)(UINTN)CommBufferSize, sizeof(UINTN))) { > - DEBUG ((EFI_D_ERROR, "GetStatistics: SMM communication buffer in > SMRAM!\n")); > - Status =3D EFI_ACCESS_DENIED; > - goto EXIT; > - } > + // > + // Do not need to check CommBufferSize buffer as it should point t= o > SMRAM > + // that was used by SMM core to cache CommSize from > SmmCommunication protocol. > + // >=20 > Status =3D SmmVariableGetStatistics (VariableInfo, &InfoSize); > *CommBufferSize =3D InfoSize + > SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel