From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.9192.1595378831486026271 for ; Tue, 21 Jul 2020 17:47:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Azb9PK9K; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: guomin.jiang@intel.com) IronPort-SDR: 66Dlz1g9xMTJKcIZQLLD2BrkIq+HKPkTmfDNi0N3zU4WaSG1W4ST39tTBNzEah88rewwkBUcMh P2nsJw+RNT7Q== X-IronPort-AV: E=McAfee;i="6000,8403,9689"; a="130334643" X-IronPort-AV: E=Sophos;i="5.75,381,1589266800"; d="scan'208";a="130334643" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 17:47:10 -0700 IronPort-SDR: oOGdkdUBKHxAqVMsTRqZUj+POCRu5RDvp/6IkkGYQUw6BftpJ3nOjoI8wxp/sBbjTA24XrnsYE U+3CPANK4emQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,381,1589266800"; d="scan'208";a="487814425" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by fmsmga006.fm.intel.com with ESMTP; 21 Jul 2020 17:47:10 -0700 Received: from orsmsx151.amr.corp.intel.com (10.22.226.38) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 17:47:09 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX151.amr.corp.intel.com (10.22.226.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 17:47:09 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.52) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 17:47:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gVw61+WbdWzCSdWW2w8+gQEqw9+iLbbjjr/phYxgX/QD2lnaamqXU7H3TFfCQOxuuN0Y8SndgKUrvhJvripbK2MebpMBfOR7fX6U6HIZpFLTzppclid8c9RmqioLG2FSkeQRsJA453dfv2RDOWwUM6MtnqVdfgQcaZtFs49NQdqzIAzpA9oyRmXZXtg3tjWssdjMikwRbKXgsQUOFwXaUuOvNuuQOw5XCoZRmt74HhgDYFWWMXWvC1Iz0s46vfVmSNjumfinikJVl99szy38c7VZYphn9HYuADP8sJV6IYRZa11nNPOcPYWuYs4HHTdKqj2pgoqY64UuIq2LYoGMhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sceJ3zW3nca+wMNCGWfy5HgEIoFHZjaRUo9dGWsgkGM=; b=DEP2nNGx0sf1MxEqsRVFlLrsDY1j3n3SLSwtgsPu1SyRQ1Oh7tMkdMf3h0o3ogZJGZhqCKDBKtDxilWEFX/eBpFsht7v68QAXAEZ/9w96IdoNmu04P+0PvNSPHv9cOZfclXOZolvb1ZjKFgxy5aba+vMV5VwDlxDwYwgKkxc8mOCl+quw2ycp4nVSY62T9T1LC0BjpgI6RuXuvKQYG+gXA5jF2covXJXrHeX4YMfWBqs6+nQ8EOpn8YssOQ3hwEZbwK2jmDJuMPi+SYPiCYqatmVJlDS7E83QzwEd5wFZD2cjS22gE6MPd1sHOO05/PIU/+G1NOOjE3zezWSFsxqAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sceJ3zW3nca+wMNCGWfy5HgEIoFHZjaRUo9dGWsgkGM=; b=Azb9PK9KTLIPjvx6+olXNEagiKheEetiuUuVnhxETez1BgGVgzZFubUPOheiX0JpCSVL5g8qck8HVnNUeebySNVPq9SYOYxdp+tfPwBWil44LIelX1PVxPK8lrNzE4huPZIJrhmbPnLhjGMRurnpql2gULFnEBEnFJ8eFuqI8yM= Received: from DM6PR11MB2955.namprd11.prod.outlook.com (2603:10b6:5:65::31) by DM5PR11MB1340.namprd11.prod.outlook.com (2603:10b6:3:15::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18; Wed, 22 Jul 2020 00:47:06 +0000 Received: from DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::e916:c766:fc41:b51d]) by DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::e916:c766:fc41:b51d%5]) with mapi id 15.20.3174.027; Wed, 22 Jul 2020 00:47:06 +0000 From: "Guomin Jiang" To: Ming Huang , "devel@edk2.groups.io" , "Wang, Jian J" , "Wu, Hao A" , "Gao, Liming" CC: "lidongzhan@huawei.com" , "songdongkuang@huawei.com" , "wanghuiqiang@huawei.com" , "qiuliangen@huawei.com" , "shenlimei@huawei.com" , "xiewenyi2@huawei.com" , "john.garry@huawei.com" Subject: Re: [edk2-devel] [PATCH edk2 v1 1/1] MdeModulePkg/Variable: Move FindVariable after AutoUpdateLangVariable Thread-Topic: [edk2-devel] [PATCH edk2 v1 1/1] MdeModulePkg/Variable: Move FindVariable after AutoUpdateLangVariable Thread-Index: AQHWTdvc/EERFE2Is0WZy87gpc5s7qjwT42QgADH24CAAMWXUIAD98uAgB0SMoA= Date: Wed, 22 Jul 2020 00:47:06 +0000 Message-ID: References: <1593410773-62704-1-git-send-email-huangming23@huawei.com> <1593410773-62704-2-git-send-email-huangming23@huawei.com> <16e7bca1-f07a-ce3e-7699-97603828d0b5@huawei.com> In-Reply-To: <16e7bca1-f07a-ce3e-7699-97603828d0b5@huawei.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.203] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bac54990-1a66-4635-42ae-08d82dd8c214 x-ms-traffictypediagnostic: DM5PR11MB1340: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Wpu0C+WOGoNP21CjyknLu9RUOD1WArySQHJtuwaOJ5t5l7mWdiHglphwIG/gpZIzcF5WgNfeFCFoib3D6PO2PRm7UrVfSMKKwwkqkLL/X40PvxIkTJc/5WsDHT3IdK5YQgzYHmPNpwnks76BxI/rhEGfnWjLIT5bLODpOXH5inPKbiUlKf9NSAfOjoATOow0jzHrh9f7MdMItchpe0jLORRr7NiheORQB307m/F2XUVfF2cwn9ZvpGSkfiEC6Zk9goD3Em/t8jWhCeVYS6MXhi3bjeIsdgmW9NkcUlZDGQDh54nxUf3VsFEBVfPLEcWBDRBzgRWJVzfqBCnykd9CRhEVMyljZbCE/EoUrHObLHUvY247q4sMVMMuC7mP5zDpY2J9/Wq/gT5Jb6zMCvxiyA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB2955.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(39860400002)(136003)(376002)(366004)(346002)(53546011)(71200400001)(6506007)(7696005)(66476007)(5660300002)(76116006)(52536014)(33656002)(66446008)(64756008)(66946007)(66556008)(8676002)(9686003)(26005)(54906003)(186003)(4326008)(55016002)(8936002)(86362001)(2906002)(6636002)(316002)(110136005)(83380400001)(478600001)(966005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Wx79umxXxTJQhpk2ZMYUpZ8JFOOp0IwCec7mbU+EiPVMz3jl3FMWG/u9ce5jUzj3f2IZJWcRJI5dGasTy+L4LfM+Wa7kY6EaDu2+LQoiYW6WmWDU5s5bzcTENUeZ+OZrwR8FHum+t57a4oqoWIehMQddu/+4k7q9dfuBRkv1xeOb/2/AicuzzqRwV3+P4z/qsnerGVmUwcdzUXpuPBVuFH/je3FLl0yJhMEATMhKVIxbkFEua3rR1Iw7WAKJDe8hcZdwxVuX6/kGh1QGKEmjnEBjkcPnGW6RPVg/Muob8/FrTBNO9X8MPJ5ilOf2BaWMNOyLJvHqgm+7etCTkDTj3oV4BGDvmVO0wLJIRz3xh6tMF8QrlJ9FbwTngsr0k0ZTEDW0xegR82ZzO2JUA0nijaEtRDlu6EGJfKaimThELcGafpLrohXwkKa96ER91O29Jrc/2No6xTEmX2lVaG5ZMTPO7ar65FDrg/bUzQ6SmldTUc+qpHkGUL98uvahNFhB MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB2955.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bac54990-1a66-4635-42ae-08d82dd8c214 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2020 00:47:06.3989 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KedhWCNa/YrtgY0h78G1kkUUUWcz2rSjiAKpndtXDLX5KQOoTx3sRM/5IC43780e3Z5LYcVCZJVhB0olsyuWMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1340 Return-Path: guomin.jiang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Hi Ming, The new posted change https://edk2.groups.io/g/devel/topic/75412007#62327 = may be helpful for this issue. Can you add the change in your code and verify it? Thanks Guomin > -----Original Message----- > From: Ming Huang > Sent: Friday, July 3, 2020 8:49 PM > To: Jiang, Guomin ; devel@edk2.groups.io; Wang, > Jian J ; Wu, Hao A ; Gao, > Liming > Cc: lidongzhan@huawei.com; songdongkuang@huawei.com; > wanghuiqiang@huawei.com; qiuliangen@huawei.com; > shenlimei@huawei.com; xiewenyi2@huawei.com; john.garry@huawei.com > Subject: Re: [edk2-devel] [PATCH edk2 v1 1/1] MdeModulePkg/Variable: > Move FindVariable after AutoUpdateLangVariable >=20 >=20 >=20 > =1B$B:_=1B(B 2020/7/1 8:22, Jiang, Guomin =1B$B > So I think the key point is why AutoUpdateLangVariable() return succes= s > rather than fail, if is it reasonable for this case or we need other err= or > handing? >=20 > I don't think AutoUpdateLangVariable() should return fail while occur re= claim > internal in AutoUpdateLangVariable () function. The problem is the > Variable(VARIABLE_POINTER_TRACK) get by FindVariable is invald in this > situation and this Variable will be pass to UpdateVariable(). >=20 > if (mVariableModuleGlobal->VariableGlobal.AuthSupport) { > Status =3D AuthVariableLibProcessVariable (VariableName, VendorGuid, > Data, DataSize, Attributes); > } else { > // This Variable is invald while occur reclaim internal in > AutoUpdateLangVariable () > Status =3D UpdateVariable (VariableName, VendorGuid, Data, DataSize, > Attributes, 0, 0, &Variable, NULL); > } >=20 > > > > I am glad to help you but I can't reproduce it until now, can you prov= ide a > step to reproduce it in simulation platform. >=20 > I am not familiar with simulation platform. We reproduct this issue in o= ur > board once. > For accelerating reproduction this issue, Add Reclaim() to > AutoUpdateLangVariable() for test. >=20 > Thanks, > Ming >=20 > > > > If it is urgent, I suggest that discuss with your internal team first = and explain > that we need consider the risk check it into edk2. > > > > Best Regards > > Guomin > > > >> -----Original Message----- > >> From: devel@edk2.groups.io On Behalf Of Ming > >> Huang via groups.io > >> Sent: Tuesday, June 30, 2020 8:26 PM > >> To: Jiang, Guomin ; devel@edk2.groups.io; > >> Wang, Jian J ; Wu, Hao A ; > >> Gao, Liming > >> Cc: lidongzhan@huawei.com; songdongkuang@huawei.com; > >> wanghuiqiang@huawei.com; qiuliangen@huawei.com; > shenlimei@huawei.com; > >> xiewenyi2@huawei.com > >> Subject: Re: [edk2-devel] [PATCH edk2 v1 1/1] MdeModulePkg/Variable: > >> Move FindVariable after AutoUpdateLangVariable > >> > >> > >> > >> =1B$B:_=1B(B 2020/6/30 8:58, Jiang, Guomin =1B$B >>> Hi Huang, > >>> > >>> >From issue statement, I guess that > >>> 1. AutoUpdateLangVariable() invoked, and it will invoke > >>> FindVariable() first, at the same time, reclaim occur and > >>> Variable.CurrPtr is invalid, it return > >> with success 2. UpdateVariable() is invoked when The old Lang's State > >> is valid and the new Lang's State is also valid. > >>> 3. In the situation, FindVariable() checked Lang's State and only > >>> enable one > >> Lang's State. But it didn't in fact. > >>> 4. BmForEachVariable() deadloop in the situation. > >>> > >>> Am I right? > >> > >> Yes, right. > >> > >> Thanks, > >> Ming > >> > >>> > >>>> -----Original Message----- > >>>> From: devel@edk2.groups.io On Behalf Of > Ming > >>>> Huang via groups.io > >>>> Sent: Monday, June 29, 2020 2:06 PM > >>>> To: devel@edk2.groups.io; Wang, Jian J ; Wu, > >>>> Hao A ; Gao, Liming > >>>> Cc: lidongzhan@huawei.com; huangming23@huawei.com; > >>>> songdongkuang@huawei.com; wanghuiqiang@huawei.com; > >>>> qiuliangen@huawei.com; shenlimei@huawei.com; > >> xiewenyi2@huawei.com > >>>> Subject: [edk2-devel] [PATCH edk2 v1 1/1] MdeModulePkg/Variable: > >> Move > >>>> FindVariable after AutoUpdateLangVariable > >>>> > >>>> When occur reclaim in AutoUpdateLangVariable(), the CurrPtr of > >>>> Variable is invalid. The State will be update with wrong position > >>>> after UpdateVariable in this situation and two valid PlatformLang > >>>> or Lang > >> variables will exist. > >>>> BmForEachVariable() will enter endless loop while exist two valid > >>>> PlatformLang variables. So FindVariable() should be invoked atfer > >>>> AutoUpdateLangVariable(). > >>>> > >>>> https://bugzilla.tianocore.org/show_bug.cgi?id=3D2667 > >>>> > >>>> Signed-off-by: Ming Huang > >>>> --- > >>>> MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 26 > >>>> ++++++++++---------- > >>>> 1 file changed, 13 insertions(+), 13 deletions(-) > >>>> > >>>> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >>>> b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >>>> index 1e71fc6..0cec981 100644 > >>>> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >>>> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >>>> @@ -2741,6 +2741,19 @@ VariableServiceSetVariable ( > >>>> mVariableModuleGlobal->NonVolatileLastVariableOffset =3D (UINT= N) > >>>> NextVariable - (UINTN) Point; > >>>> } > >>>> > >>>> + if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { > >>>> + // > >>>> + // Hook the operation of setting > >>>> + PlatformLangCodes/PlatformLang and > >>>> LangCodes/Lang. > >>>> + // > >>>> + Status =3D AutoUpdateLangVariable (VariableName, Data, DataSiz= e); > >>>> + if (EFI_ERROR (Status)) { > >>>> + // > >>>> + // The auto update operation failed, directly return to > >>>> + avoid > >>>> inconsistency between PlatformLang and Lang. > >>>> + // > >>>> + goto Done; > >>>> + } > >>>> + } > >>>> + > >>>> // > >>>> // Check whether the input variable is already existed. > >>>> // > >>>> @@ -2763,19 +2776,6 @@ VariableServiceSetVariable ( > >>>> } > >>>> } > >>>> > >>>> - if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { > >>>> - // > >>>> - // Hook the operation of setting PlatformLangCodes/PlatformLan= g > and > >>>> LangCodes/Lang. > >>>> - // > >>>> - Status =3D AutoUpdateLangVariable (VariableName, Data, DataSiz= e); > >>>> - if (EFI_ERROR (Status)) { > >>>> - // > >>>> - // The auto update operation failed, directly return to avoi= d > >> inconsistency > >>>> between PlatformLang and Lang. > >>>> - // > >>>> - goto Done; > >>>> - } > >>>> - } > >>>> - > >>>> if (mVariableModuleGlobal->VariableGlobal.AuthSupport) { > >>>> Status =3D AuthVariableLibProcessVariable (VariableName, > >>>> VendorGuid, Data, DataSize, Attributes); > >>>> } else { > >>>> -- > >>>> 2.8.1 > >>>> > >>>> > >>>> > >>> > >>> > >>> > >> > >> > >>=20 > > > > > > . > >