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.93; helo=mga11.intel.com; envelope-from=ray.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 4E638211D56BB for ; Tue, 5 Mar 2019 21:46:38 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 21:46:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,446,1544515200"; d="scan'208";a="324622393" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 05 Mar 2019 21:46:38 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 21:46:37 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 21:46:37 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.26]) with mapi id 14.03.0415.000; Wed, 6 Mar 2019 13:46:29 +0800 From: "Ni, Ray" To: "Gao, Liming" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Chen, Chen A" Thread-Topic: [edk2] [PATCH] UefiCpuPkg/Microcode.c: Add verification before calculate CheckSum32 Thread-Index: AQHU0ul7UqdVE3cgxE+vP6lcradFFaX939nwgAA3btD//3paAIAAiOqw Date: Wed, 6 Mar 2019 05:46:29 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C0603DC@SHSMSX104.ccr.corp.intel.com> References: <20190305002118.10572-1-chen.a.chen@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C05FD4A@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C060342@SHSMSX104.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E3FC008@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3FC008@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg/Microcode.c: Add verification before calculate CheckSum32 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2019 05:46:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed @ 219e560c20034843ac9917146c60db99bd01b6f4. > -----Original Message----- > From: Gao, Liming > Sent: Wednesday, March 6, 2019 1:38 PM > To: Ni, Ray ; edk2-devel@lists.01.org > Cc: Dong, Eric ; Chen, Chen A > > Subject: RE: [edk2] [PATCH] UefiCpuPkg/Microcode.c: Add verification > before calculate CheckSum32 >=20 > This is a bug. I agree to add it into Q1 stable tag. >=20 > Thanks > Liming > > -----Original Message----- > > From: Ni, Ray > > Sent: Tuesday, March 5, 2019 9:35 PM > > To: edk2-devel@lists.01.org; Gao, Liming > > Cc: Dong, Eric ; Ni, Ray ; > > Chen, Chen A > > Subject: RE: [edk2] [PATCH] UefiCpuPkg/Microcode.c: Add verification > > before calculate CheckSum32 > > > > Liming, > > Do I need any approval from you side before pushing the commit? > > > > Thanks, > > Ray > > > > > -----Original Message----- > > > From: edk2-devel On Behalf Of Ni, > > > Ray > > > Sent: Wednesday, March 6, 2019 10:15 AM > > > To: Chen, Chen A ; edk2-devel@lists.01.org > > > Cc: Dong, Eric > > > Subject: Re: [edk2] [PATCH] UefiCpuPkg/Microcode.c: Add verification > > > before calculate CheckSum32 > > > > > > Reviewed-by: Ray Ni > > > > > > > -----Original Message----- > > > > From: edk2-devel On Behalf Of > > > > Chen A Chen > > > > Sent: Tuesday, March 5, 2019 8:21 AM > > > > To: edk2-devel@lists.01.org > > > > Cc: Dong, Eric > > > > Subject: [edk2] [PATCH] UefiCpuPkg/Microcode.c: Add verification > > > > before calculate CheckSum32 > > > > > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1020 > > > > > > > > Should make sure the TotalSize of Microcode is aligned with 4 > > > > bytes before calling CalculateSum32 function. > > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Signed-off-by: Chen A Chen > > > > Cc: Ray Ni > > > > Cc: Eric Dong > > > > --- > > > > UefiCpuPkg/Library/MpInitLib/Microcode.c | 31 > > > ++++++++++++++++++++-- > > > > --------- > > > > 1 file changed, 20 insertions(+), 11 deletions(-) > > > > > > > > diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c > > > > b/UefiCpuPkg/Library/MpInitLib/Microcode.c > > > > index 5f9ae22794..643a6f94f4 100644 > > > > --- a/UefiCpuPkg/Library/MpInitLib/Microcode.c > > > > +++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c > > > > @@ -166,20 +166,29 @@ MicrocodeDetect ( > > > > // > > > > CorrectMicrocode =3D FALSE; > > > > > > > > - // > > > > - // Save an in-complete CheckSum32 from CheckSum Part1 for > common > > > > parts. > > > > - // > > > > if (MicrocodeEntryPoint->DataSize =3D=3D 0) { > > > > - InCompleteCheckSum32 =3D CalculateSum32 ( > > > > - (UINT32 *) MicrocodeEntryPoint, > > > > - sizeof (CPU_MICROCODE_HEADER) + 200= 0 > > > > - ); > > > > + TotalSize =3D sizeof (CPU_MICROCODE_HEADER) + 2000; > > > > } else { > > > > - InCompleteCheckSum32 =3D CalculateSum32 ( > > > > - (UINT32 *) MicrocodeEntryPoint, > > > > - sizeof (CPU_MICROCODE_HEADER) + > > > MicrocodeEntryPoint- > > > > >DataSize > > > > - ); > > > > + TotalSize =3D sizeof (CPU_MICROCODE_HEADER) + > > > > + MicrocodeEntryPoint- > > > > >DataSize; > > > > } > > > > + > > > > + /// > > > > + /// Check overflow and whether TotalSize is aligned with 4 byt= es. > > > > + /// > > > > + if ( ((UINTN)MicrocodeEntryPoint + TotalSize) > MicrocodeEnd |= | > > > > + (TotalSize & 0x3) !=3D 0 > > > > + ) { > > > > + MicrocodeEntryPoint =3D (CPU_MICROCODE_HEADER *) (((UINTN) > > > > MicrocodeEntryPoint) + SIZE_1KB); > > > > + continue; > > > > + } > > > > + > > > > + // > > > > + // Save an in-complete CheckSum32 from CheckSum Part1 for > > > > + common > > > > parts. > > > > + // > > > > + InCompleteCheckSum32 =3D CalculateSum32 ( > > > > + (UINT32 *) MicrocodeEntryPoint, > > > > + TotalSize > > > > + ); > > > > InCompleteCheckSum32 -=3D MicrocodeEntryPoint- > > > > >ProcessorSignature.Uint32; > > > > InCompleteCheckSum32 -=3D MicrocodeEntryPoint->ProcessorFlags; > > > > InCompleteCheckSum32 -=3D MicrocodeEntryPoint->Checksum; > > > > -- > > > > 2.16.2.windows.1 > > > > > > > > _______________________________________________ > > > > edk2-devel mailing list > > > > edk2-devel@lists.01.org > > > > https://lists.01.org/mailman/listinfo/edk2-devel > > > _______________________________________________ > > > edk2-devel mailing list > > > edk2-devel@lists.01.org > > > https://lists.01.org/mailman/listinfo/edk2-devel