From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.5278.1623397695325411671 for ; Fri, 11 Jun 2021 00:48:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=sivwVGKK; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: hao.a.wu@intel.com) IronPort-SDR: girLBZLuLWaL+yemtFBs/Go9cEEPJ3YOgXUuHywWUO1SM5ZMR7+5NPs/ABD5omE1mBMkUt05ya yo1YVPGepUhw== X-IronPort-AV: E=McAfee;i="6200,9189,10011"; a="205510487" X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="205510487" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2021 00:48:15 -0700 IronPort-SDR: RYBWTzzB1llNTGo6j2OeFR2Q9JOFFoP183pIbeD85mVr8PNCIRl+FJk7FEgCttOqnfB8WdBqcq aKMlQe206eZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="450679517" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2021 00:48:14 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 11 Jun 2021 00:48:14 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Fri, 11 Jun 2021 00:48:14 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.174) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Fri, 11 Jun 2021 00:46:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n8CkHW9dkdjaXvRkwjuD6AgjymRlODkaIfiJ/88kLEQMNZ6v/851g37CAupLe+9qY5wB73spygDYCU/oKcQqrSWBErFkeo277zth/Njf87H9s7VdEiKYHDAiTF3zIRZlnHXao9njldY8EfdKlp4CfGlNI0a6Q7tbIQtQQWF4TVLMBsbyjdSILVUhGFWme3Pzm0PwieBAD0fi4Yuw3N7z/XRRC7oHb694vKBYlLUDOz6PcLlpU7dqTtwM2mUF7g5IIlm9abodA6kqvBQOwOHPhRu97a7Z851e4nrhzC1QamoezUl60zmlr415No+7hh3HvCNRgjV93wapK8Yk/bxKzA== 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=9KRkQm4/6GJARWdqIsmFSwKNq1wyO+YDjkBQaN3gj5w=; b=M/skxtqsJLrjGH8tOnxznkex48gWkE1Ad//WQHVQ201qyaW9Wb1JeDMWkQSSkLbYYTH93Fo9NX96OUGBAoxwWYnCbmWje2iiObYXFWNvKP9gNFrWrq3RcTB4dltNguNxpT81feOCCiizmy7Eq4YSur41Z8cFUnM4NNGTeyOKaCiQ5D2XayvJzy+NQd2Vy3dyU9bOGXy4QYrNmdPIGUTlSaSK/x8Abh7ZcUh5JBkGZVm7/OIvRSWReytLyJzFpPDIDRkifuey73gl1ghe3pQadqL+RCCq+i1C7HehiVfcXmQIRYzKZELYuQfxHea+8xe5XoJ1k3NzE3BiSiSZGfpm+g== 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=9KRkQm4/6GJARWdqIsmFSwKNq1wyO+YDjkBQaN3gj5w=; b=sivwVGKK+VBqsdLjtn/P73vbIvGjulT/ZugeBveZjiEkAWs/+g8rC7lDyy1WgPM6Sul5XQlI+OfYENr5SzAWSmSxjb0JcQoG94igk0TwsJkcWXOMQQDJFluuMZS8PepAABfK9VazUtk3kjIKLnCQkAOxO418suGaT0vjB4AvdYM= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR1101MB2161.namprd11.prod.outlook.com (2603:10b6:405:52::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.26; Fri, 11 Jun 2021 07:46:54 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::b9d0:5694:1b70:c031]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::b9d0:5694:1b70:c031%4]) with mapi id 15.20.4195.032; Fri, 11 Jun 2021 07:46:54 +0000 From: "Wu, Hao A" To: Kun Qin , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Dong, Eric" , "Ni, Ray" Subject: Re: [PATCH v1 2/5] MdeModulePkg: PiSmmIpl: Update MessageLength calculation for MmCommunicate Thread-Topic: [PATCH v1 2/5] MdeModulePkg: PiSmmIpl: Update MessageLength calculation for MmCommunicate Thread-Index: AQHXXZn+Bm3xzcl+i0C1BzhOMQegaasOZm9A Date: Fri, 11 Jun 2021 07:46:54 +0000 Message-ID: References: <20210610014259.1151-1-kuqin12@gmail.com> <20210610014259.1151-3-kuqin12@gmail.com> In-Reply-To: <20210610014259.1151-3-kuqin12@gmail.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.143.16] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 81c9464e-d6cf-44df-1035-08d92cad154d x-ms-traffictypediagnostic: BN6PR1101MB2161: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:197; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ma4ZXmWczzIKu2k8kXhTAjuOsNF1ExC+HmjRzr2KvkeDimg/Smk8umg2Wqy4lz5S4BBaNTR/KrvE3Vel3xMKXU2VmEufV8s/2MNeRYK3LybHodvcu14n+GjPyjSvZmvRILj/YzsNdGttUH6NmL8BnCx/p8KhWf1K7TDdz2CxnH1XABgiQTp49hvA4t0kg0bCC2zdMjXM13gFvrojtWchkgfEDIp9Q4foc4tOl5Fp2MVx3obuToNIbp85XqcL9c61SgqrD10YmdT728/pM3nDe7TFhSMH+JWRNVwO6XSqm/0QEo3cgnUcwF2A/snuR71TfG84Mm2FTMSFAG+h93dgant0np6GSR2wvklPHy+HzqvdZAlAiUId1DNc78pbMES19nFXg42V70JW4Y8/BCJn6cntT1K26PUjckR26+aQqtQCDovWo1yPfi+ysZAwdsVXRS79KWRFxJzX+Iwspg4V4Zjpn0jsC+mLWA0npA6BQJyq2TIreKC4mm1/Rcc2tM+RDXTQFlMPsigaWO+nH5KvL5hVMlZuk70Sx4oYGMGBsgR02R/YfPwrGzJxzeoBHc2XWEDTMb5/JMJF42PPTU+aGGcyKAKC08YKbOIwIsM1BKD3sOkmaoigBDwKTaO6c4y5Buja/IW8RXBgafIhHgN0EqqdSWg3B2V4HSzzytw5LLhU9bm+1KQtRpGF07VFuCNbsHQghXi2k1lsdMGdtQPVZrz1hSVtHq1UXmXXNVU187E= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(346002)(366004)(376002)(136003)(396003)(39860400002)(52536014)(54906003)(107886003)(66946007)(15650500001)(76116006)(86362001)(2906002)(110136005)(66446008)(4326008)(6506007)(316002)(66556008)(7696005)(38100700002)(8936002)(33656002)(19627235002)(478600001)(66476007)(64756008)(53546011)(966005)(8676002)(9686003)(55016002)(5660300002)(71200400001)(186003)(122000001)(83380400001)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?r3Q7GZwIYim3GMNBmAI1wF9Ff4JDmg6zFQMpeW5poBnK//gNh2gfpM9W06lh?= =?us-ascii?Q?ZFvp4+PCbBlLXYb9yBrLNCw81A5ALJnIHXUvEs6sCQEM0iAB62ewUE8JGsI3?= =?us-ascii?Q?AWSQh6DKuO8p1KCNd6eoh6M9Tstq8KYLm0FnLUvzVi5bDGnTlKbihsbVgzm6?= =?us-ascii?Q?S08wb+M9Voh5LN8Lu/fe3r8UH47VtOsrmi5FT/fMq6XvNXGZrgwP+rJ+0S0j?= =?us-ascii?Q?bcgOeA5oMTVfqObhwzD1YdYK86Be+Gt6xicstbpTCyqEyqaC7PqNIcobiU+W?= =?us-ascii?Q?x48GImE3dlcrCVfLavcd2OZSZe3mWBtu+HeaytgY2Q44WZdSn5zjKRdiznnw?= =?us-ascii?Q?9WTEsZRQx3qNch173KOUJZFYV+zzePql6k6550jDU3nSF+gWyasM+2deVQKq?= =?us-ascii?Q?evb+4i5kZ1/xY6RdjICmpLXTrkvP9IS9c4AzLbsf6FIhRGXfLDJKpBd9iCj4?= =?us-ascii?Q?Zz5UeFEl0XvmNdG0g5K3QZIMJg+AzjUnGe52wkwb5sQGe/g0PIwS1yIvnTNQ?= =?us-ascii?Q?rZjJwk6J7V8n1vZQPrSZdLzgUSAsBR/6fU+GGk2nSuWT1cQx5dJSaie+3GN0?= =?us-ascii?Q?16tPi2todCQXlW2SXEp0Ke1wQ0fmFGTvuEoT9jFID8OLkHexEBJShw9z7GcW?= =?us-ascii?Q?rXRCMW8JgrOS37zAZx/g1wfPImYI3bDTcNc4P2xfGk4shtWpWnpH8Bo8eX6w?= =?us-ascii?Q?mSd6j1GiVe+XWWu2a/lzjRA0hA9jp3Y72Pg2cEOpVuPKjxffJIlsl7vqf8Vh?= =?us-ascii?Q?Ix9XOEQkEp8QKiPF1bIeniq6qnkWOIGpk8FtotsyPiQeTGVlqe8lpzZwSSDz?= =?us-ascii?Q?PefEJicLlSiqfzJsUlA4QsaSvvB42kWxhBjmB3BYfhXcQv41ipcY2bvo9nmr?= =?us-ascii?Q?4kAx4pLblBUI1jLWqsuJa22gt4bkzTonlAuEBeOaSeZWGPN9zUtaBR6cUN61?= =?us-ascii?Q?a+SozLCyVk3wv/mUvB8svUtqJrLjK7gr0gZdQxogzm9xeT1g4GNy5UUDfGIS?= =?us-ascii?Q?qppza4WieXC6CnxuYkn+x81RHC9voYoIjfRT5o4DeJBQcp+QAvrgrGCxWtCs?= =?us-ascii?Q?GXrNlP+1Z1ETUCA9M59JKsGvanrNQsMb8S3XmcmjssDWmxWR0UOXePu1gQxW?= =?us-ascii?Q?5Ts/EF/V+FZSphEYpRQi4cKJww3P0zQa96ESwwIVJ4AWkd497bLSJXRVsIJI?= =?us-ascii?Q?1jN3s0iXJmJgan5aW2tMwqXDtY09hYPjMe1SCoK/N4l8NOxScQF9g+hrzuk5?= =?us-ascii?Q?2mQKunZIgWeYbJ5Qbjd+8WA6lZ8foiKGBYpS+V5IME5wMJ2XYb2D66Bv3FfZ?= =?us-ascii?Q?uKLK0i533H4QG7YRCdr9hI70?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81c9464e-d6cf-44df-1035-08d92cad154d X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2021 07:46:54.6883 (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: jGl9xxE+2XuwAjz4FNpppox0ll3WUQ2hi2NwIG3FvahsjWI12N8kAquE6Jpkin5hYA1BMMUq1w3tdkWf4XMdtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2161 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable A couple of minor comments below: > -----Original Message----- > From: Kun Qin > Sent: Thursday, June 10, 2021 9:43 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A ; > Dong, Eric ; Ni, Ray > Subject: [PATCH v1 2/5] MdeModulePkg: PiSmmIpl: Update MessageLength > calculation for MmCommunicate >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3398 >=20 > This change updated calculation routine for MM communication in PiSmmIpl. > It removes ambiguity brought in by UINTN variables from this routine and > paves way for updating definition of field MessageLength in > EFI_MM_COMMUNICATE_HEADER to definitive size. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Eric Dong > Cc: Ray Ni >=20 > Signed-off-by: Kun Qin > --- > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 13 ++++++++++++- > MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 1 + > 2 files changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c > b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c > index 599a0cd01d80..9508715fda24 100644 > --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c > +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include // BZ3398 I suggest to remove the comment "// BZ3398" here. I think users can use the 'blame' feature of the version control systems together with the commit log message to find out the information. >=20 > #include "PiSmmCorePrivateData.h" >=20 > @@ -515,6 +516,7 @@ SmmCommunicationCommunicate ( > EFI_STATUS Status; > EFI_SMM_COMMUNICATE_HEADER *CommunicateHeader; > BOOLEAN OldInSmm; > + UINT64 BZ3398_LongCommSize; Suggest to drop the "BZ3398_" prefix for the variable name. > UINTN TempCommSize; >=20 > // > @@ -527,7 +529,16 @@ SmmCommunicationCommunicate ( > CommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) > CommBuffer; >=20 > if (CommSize =3D=3D NULL) { > - TempCommSize =3D OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) > + CommunicateHeader->MessageLength; > + // BZ3398 Starts: Make MessageLength the same size in > EFI_MM_COMMUNICATE_HEADER for both IA32 and X64. Suggest to drop the "// BZ3398 Starts:" and "// BZ3398 Ends" comments pair = here. With above handled: Reviewed-by: Hao A Wu Best Regards, Hao Wu > + Status =3D SafeUint64Add (OFFSET_OF > (EFI_SMM_COMMUNICATE_HEADER, Data), CommunicateHeader- > >MessageLength, &BZ3398_LongCommSize); > + if (EFI_ERROR (Status)) { > + return EFI_INVALID_PARAMETER; > + } > + Status =3D SafeUint64ToUintn (BZ3398_LongCommSize, &TempCommSize); > + if (EFI_ERROR (Status)) { > + return EFI_INVALID_PARAMETER; > + } > + // BZ3398 Ends > } else { > TempCommSize =3D *CommSize; > // > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > index 6109d6b5449c..87142e27fa47 100644 > --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf > @@ -46,6 +46,7 @@ [LibraryClasses] > DxeServicesLib > PcdLib > ReportStatusCodeLib > + SafeIntLib #BZ3398 >=20 > [Protocols] > gEfiSmmBase2ProtocolGuid ## PRODUCES > -- > 2.31.1.windows.1