From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 68326209884C3 for ; Mon, 18 Jun 2018 07:59:40 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2018 07:59:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,239,1526367600"; d="scan'208";a="47965071" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 18 Jun 2018 07:59:39 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Jun 2018 07:59:39 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Jun 2018 07:59:39 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.223]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.51]) with mapi id 14.03.0319.002; Mon, 18 Jun 2018 22:59:37 +0800 From: "Yao, Jiewen" To: Udit Kumar CC: Ard Biesheuvel , "Kinney, Michael D" , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v2 2/5] MdeModulePkg/DxeCapsuleLibFmp: permit ProcessCapsules () to be called once Thread-Index: AQHT/vYbbSADsfB+hEWX7Kwk2kNBmKRWSrdAgA+ViECAAEln4A== Date: Mon, 18 Jun 2018 14:59:35 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AC4EDDF@shsmsx102.ccr.corp.intel.com> References: <20180608065811.2065-1-ard.biesheuvel@linaro.org> <20180608065811.2065-3-ard.biesheuvel@linaro.org> <74D8A39837DF1E4DA445A8C0B3885C503AC3515B@shsmsx102.ccr.corp.intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTVlMGZlNjUtY2ZkNy00OGU1LTk5MWMtZTVlYjQ5ODA4NjIyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaDhQWThmSGR4YnJObXptVUZXbkVJbHhnNkhCWGlnRnFxKzFUT2dwMnVvbXM0SnZ5VU40WlNVZTJOcFJzU1lDMSJ9 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 v2 2/5] MdeModulePkg/DxeCapsuleLibFmp: permit ProcessCapsules () to be called once X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2018 14:59:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Good question. That is because there may be some flash hardware feature to = lock the flash part early, and unlockable even in SMM. As defense in depth, SMM protection can still be enabled. And the flash upd= ate must happen before EndOfDxe. Thank You Yao Jiewen > -----Original Message----- > From: Udit Kumar [mailto:udit.kumar@nxp.com] > Sent: Monday, June 18, 2018 3:36 AM > To: Yao, Jiewen > Cc: Ard Biesheuvel ; Kinney, Michael D > ; edk2-devel@lists.01.org; > leif.lindholm@linaro.org; Zeng, Star > Subject: RE: [edk2] [PATCH v2 2/5] MdeModulePkg/DxeCapsuleLibFmp: permit > ProcessCapsules () to be called once >=20 > Hi Jiewen, >=20 > I don't know x86 in details , so ignore stupid question, > Also thanks to bear with unrelated question. >=20 > > In our X86 system design, we lock flash part *before* EndOfDxe in any b= oot > > mode. > > Even in CapsuleUpdate boot mode, we also lock flash part at EndOfDxe, j= ust > > in case the capsule update does not indicate a reset. >=20 > On x86, we have SMM mode and I think this is assumed to be secured . > What is restriction that flash update is done after reset. This could be > done in same call of OS in SMM mode. >=20 > Regards > Udit >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Yao, Jiewen > > Sent: Friday, June 8, 2018 6:05 PM > > To: Ard Biesheuvel ; edk2-devel@lists.01.org > > Cc: Kinney, Michael D ; > > leif.lindholm@linaro.org; Zeng, Star > > Subject: Re: [edk2] [PATCH v2 2/5] MdeModulePkg/DxeCapsuleLibFmp: > > permit ProcessCapsules () to be called once > > > > Hi Ard > > We don't allow platform to update system firmware *after* EndOfDxe. > > > > According to PI spec, after EndOfDxe, 3rd part code start running. It b= rings > > security risk if we allow system firmware after EndOfDxe. > > > > In our X86 system design, we lock flash part *before* EndOfDxe in any b= oot > > mode. > > Even in CapsuleUpdate boot mode, we also lock flash part at EndOfDxe, j= ust > > in case the capsule update does not indicate a reset. > > > > Would you please share the info, why your platform need update system > > firmware after EndOfDxe? > > Is that possible to make it earlier? > > > > > > Thank you > > Yao Jiewen > > > > > -----Original Message----- > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf O= f > > > Ard Biesheuvel > > > Sent: Friday, June 8, 2018 2:58 AM > > > To: edk2-devel@lists.01.org > > > Cc: Kinney, Michael D ; Yao, Jiewen > > > ; Zeng, Star ; > > > leif.lindholm@linaro.org; Ard Biesheuvel > > > Subject: [edk2] [PATCH v2 2/5] MdeModulePkg/DxeCapsuleLibFmp: > > permit > > > ProcessCapsules () to be called once > > > > > > Permit ProcessCapsules () to be called only a single time, after > > > EndOfDxe. This allows platforms that are able to update system > > > firmware after EndOfDxe (e.g., because the flash ROM is not locked > > > down) to do so at a time when a non-trusted console is up and running= , > > > and progress can be reported to the user. > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > Signed-off-by: Ard Biesheuvel > > > --- > > > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c | 18 > > > ++++++++++++------ > > > 1 file changed, 12 insertions(+), 6 deletions(-) > > > > > > diff --git > > > a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c > > > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c > > > index 26ca4e295f20..ad83660f1737 100644 > > > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c > > > +++ > > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c > > > @@ -100,6 +100,7 @@ IsValidCapsuleHeader ( > > > > > > extern BOOLEAN mDxeCapsuleLibEndOfDxe; > > > BOOLEAN mNeedReset; > > > +BOOLEAN mFirstRound =3D TRUE; > > > > > > VOID **mCapsulePtr; > > > EFI_STATUS *mCapsuleStatusArray; > > > @@ -364,8 +365,11 @@ PopulateCapsuleInConfigurationTable ( > > > > > > Each individual capsule result is recorded in capsule record varia= ble. > > > > > > - @param[in] FirstRound TRUE: First round. Need skip the > FMP > > > capsules with non zero EmbeddedDriverCount. > > > - FALSE: Process rest FMP capsules. > > > + @param[in] FirstRound Whether this is the first invocatio= n > > > + @param[in] LastRound Whether this is the last invocation > > > + FALSE: First of 2 rounds. Need ski= p > > > + the > > > FMP > > > + capsules with non zero > > > EmbeddedDriverCount. > > > + TRUE: Process rest FMP capsules. > > > > > > @retval EFI_SUCCESS There is no error when processing > > > capsules. > > > @retval EFI_OUT_OF_RESOURCES No enough resource to process > > > capsules. > > > @@ -373,7 +377,8 @@ PopulateCapsuleInConfigurationTable ( **/ > > > EFI_STATUS ProcessTheseCapsules ( > > > - IN BOOLEAN FirstRound > > > + IN BOOLEAN FirstRound, > > > + IN BOOLEAN LastRound > > > ) > > > { > > > EFI_STATUS Status; > > > @@ -453,7 +458,7 @@ ProcessTheseCapsules ( > > > continue; > > > } > > > > > > - if ((!FirstRound) || (EmbeddedDriverCount =3D=3D 0)) { > > > + if (LastRound || (EmbeddedDriverCount =3D=3D 0)) { > > > DEBUG((DEBUG_INFO, "ProcessCapsuleImage - 0x%x\n", > > > CapsuleHeader)); > > > Status =3D ProcessCapsuleImage (CapsuleHeader); > > > mCapsuleStatusArray [Index] =3D Status; @@ -546,7 +551,7 @@ > > > ProcessCapsules ( > > > EFI_STATUS Status; > > > > > > if (!mDxeCapsuleLibEndOfDxe) { > > > - Status =3D ProcessTheseCapsules(TRUE); > > > + Status =3D ProcessTheseCapsules(TRUE, FALSE); > > > > > > // > > > // Reboot System if and only if all capsule processed. > > > @@ -555,8 +560,9 @@ ProcessCapsules ( > > > if (mNeedReset && AreAllImagesProcessed()) { > > > DoResetSystem(); > > > } > > > + mFirstRound =3D FALSE; > > > } else { > > > - Status =3D ProcessTheseCapsules(FALSE); > > > + Status =3D ProcessTheseCapsules(mFirstRound, TRUE); > > > // > > > // Reboot System if required after all capsule processed > > > // > > > -- > > > 2.17.0 > > > > > > _______________________________________________ > > > edk2-devel mailing list > > > edk2-devel@lists.01.org > > > > > https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fli= s > > > ts.01.org%2Fmailman%2Flistinfo%2Fedk2- > > devel&data=3D02%7C01%7Cudit.kumar% > > > > > 40nxp.com%7C0701a8fc1bd5448675df08d5cd3c3827%7C686ea1d3bc2b4 > > c6fa92cd99 > > > > > c5c301635%7C0%7C0%7C636640580906249469&sdata=3DFi56Xg%2B1p5e6 > > 9qbD5ITsw8v > > > ve397ThhomLr9wcY9Ljc%3D&reserved=3D0 > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fli= s > > ts.01.org%2Fmailman%2Flistinfo%2Fedk2- > > devel&data=3D02%7C01%7Cudit.kumar%40nxp.com%7C0701a8fc1bd544867 > > 5df08d5cd3c3827%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7 > > C636640580906249469&sdata=3DFi56Xg%2B1p5e69qbD5ITsw8vve397Thho > > mLr9wcY9Ljc%3D&reserved=3D0