From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=qin.long@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 8A2E62098EAB6 for ; Thu, 19 Jul 2018 23:40:31 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2018 23:40:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,377,1526367600"; d="scan'208";a="59200638" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 19 Jul 2018 23:40:07 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 19 Jul 2018 23:40:06 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 19 Jul 2018 23:40:06 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.57]) with mapi id 14.03.0319.002; Fri, 20 Jul 2018 14:40:04 +0800 From: "Long, Qin" To: "Zhang, Chao B" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler Thread-Index: AQHUH0dhD3v/FSOrv0G59hR5C8qf/KSXqeTQ Date: Fri, 20 Jul 2018 06:40:04 +0000 Message-ID: References: <20180719100005.9816-1-chao.b.zhang@intel.com> In-Reply-To: <20180719100005.9816-1-chao.b.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzAyNGM0YzYtNmE4NS00OWMyLWIxNTktNzE4ZjMwN2RiYTJjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOGZibTlxUms0bFljclRRWE9aNGxvbkZVOTZQbGRFaFNJWHdlN3BIWHk2ZVQzWnBBUFlMbGl1MlJvS3ZTR2laVCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI handler X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2018 06:40:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Long Qin Best Regards & Thanks, LONG, Qin > -----Original Message----- > From: Zhang, Chao B > Sent: Thursday, July 19, 2018 6:00 PM > To: edk2-devel@lists.01.org > Cc: Long, Qin ; Yao, Jiewen ; > Zhang, Chao B > Subject: [Patch] SecurityPkg: TcgSmm: Handle invalid parameter in MOR SMI > handler >=20 > Add more logic to filter invalid function parameter in MOR Control SMI ha= ndler >=20 > Cc: Long Qin > Cc: Yao Jiewen > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chao Zhang > Signed-off-by: Zhang, Chao B > --- > SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 4 ++++ > SecurityPkg/Tcg/TcgSmm/TcgSmm.c | 4 ++++ > 2 files changed, 8 insertions(+) >=20 > diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c > b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c > index 21b1014a3b..4a1a293bfc 100644 > --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c > +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c > @@ -151,10 +151,14 @@ MemoryClearCallback ( >=20 > if (MOR_CLEAR_MEMORY_VALUE (MorControl) =3D=3D 0x0) { > return EFI_SUCCESS; > } > MorControl &=3D ~MOR_CLEAR_MEMORY_BIT_MASK; > + } else { > + mTcgNvs->MemoryClear.ReturnCode =3D MOR_REQUEST_GENERAL_FAILURE; > + DEBUG ((EFI_D_ERROR, "[TPM] MOR Parameter error! Parameter =3D %x\n"= , > mTcgNvs->MemoryClear.Parameter)); > + return EFI_SUCCESS; > } >=20 > DataSize =3D sizeof (UINT8); > Status =3D mSmmVariable->SmmSetVariable ( > MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, > diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c index 0b8a002a4d..d3ddae6886 100644 > --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c > @@ -269,10 +269,14 @@ MemoryClearCallback ( >=20 > if (MOR_CLEAR_MEMORY_VALUE (MorControl) =3D=3D 0x0) { > return EFI_SUCCESS; > } > MorControl &=3D ~MOR_CLEAR_MEMORY_BIT_MASK; > + } else { > + mTcgNvs->MemoryClear.ReturnCode =3D MOR_REQUEST_GENERAL_FAILURE; > + DEBUG ((EFI_D_ERROR, "[TPM] MOR Parameter error! Parameter =3D %x\n"= , > mTcgNvs->MemoryClear.Parameter)); > + return EFI_SUCCESS; > } >=20 > DataSize =3D sizeof (UINT8); > Status =3D mSmmVariable->SmmSetVariable ( > MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, > -- > 2.16.2.windows.1