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.11382.1644505134098346165 for ; Thu, 10 Feb 2022 06:58:54 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=JjScdGH1; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: maurice.ma@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644505134; x=1676041134; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=k/zwYarJZqsRkGUeCKy1VSgF2LO0fJ9XSP+JNsGgoUM=; b=JjScdGH1c2WodX7pvP3lEvyGlOsxxNk/VJnLC254aQmvxAoMkBnn9Zo1 g//6DNCr1o+/Une542yMEOIfjCGzjn2zEYcX9aKOvq0lBugxPsadscBRw o2XQLu5eM4obdHwhd0iz1Tt9+Nbd3YabRYpmVw50RU9DwK6McV8z5FxsC KTCbKFvueIZzyBFoCStiO6D/w3ulgi2vmzCDkH0CHXXn+OnsWizDO5z0/ NoqJ+LKA5tHrhPZq1iox+zR9X9XundTfmAr2K4CkREGUtwszPcv1hLf6E PsTS4jg6DoLCH8CmJv/Kl8sKXxGE0vNXkuOMSZDoV4jqSrhM0S1qRQARA g==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="249455804" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="249455804" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 06:58:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="541636439" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 10 Feb 2022 06:58:53 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Thu, 10 Feb 2022 06:58:52 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Thu, 10 Feb 2022 06:58:52 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Thu, 10 Feb 2022 06:58:52 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.104) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Thu, 10 Feb 2022 06:58:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QX+avA2gUmdSLbRe7huJLoAULZJnUvol7ZDKDvn0hZOyCIBGJo4BvwODjDaB+FoSXzgrmkq0/11LgH0JRYF7uWCeKP/VHCmIjtpLZelp5x5ub4yT05H1+0c2NEHITVUbF9O935iEwCzJZWLKt4iv/sFXiDrbQKbXYSnm22ReS15THtDPc0wxi6JyqBAEovHTIE6DnqO830YHcrtJLUVRNyhA6X3nANkmZsXGmT82mRCFTTQAYYDr5rcNRCRPWZZ5dc3WmwE66XOID/I0I3cWkwxrYqI4qkzuoll0d1U/nareDTtwCUI2ivl+1jMR6hOqrnNqLg+WWAJgN3xIZ1jSdw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Fbkhn31ZBVrsBQ2/+BNStyY5iznxa8ds+J8UVF1+08E=; b=NvbL9bxGEb+I1SvP3vlS4quP0NAuHKXUclv2KWs1uV+voGM9gWBimUVJ1nqqk/oQFWQZSppB4ZXryGcEa4kctoDbZnc4Q56sJy41HQAG5PGU6E3mjtnZzVLaAc8xPLKNuIqEQXyqouwqveztXZu6W5K3MUalDRfYNNtqc3E+1lT5ecjNXUQqi5jdr5aqlMNxoqDmhA5/zxTVEVjoztJznoRMBCGMlJIjzSyceMxA1vQBS1uWftvrWXO+Zk1EAHAHUIj6H86fwiDGajpfNTRj9tmW4qK1PMbL/roVJz2zqHO3525pS6znrjZ82xnIQFt415fJMmABzksJ/JEBl36o4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from CO1PR11MB4945.namprd11.prod.outlook.com (2603:10b6:303:9c::8) by CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:6e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Thu, 10 Feb 2022 14:58:51 +0000 Received: from CO1PR11MB4945.namprd11.prod.outlook.com ([fe80::c9d4:be7:7abc:48c0]) by CO1PR11MB4945.namprd11.prod.outlook.com ([fe80::c9d4:be7:7abc:48c0%4]) with mapi id 15.20.4975.013; Thu, 10 Feb 2022 14:58:51 +0000 From: "Ma, Maurice" To: "Jiang, Guomin" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Ni, Ray" , "You, Benjamin" Subject: Re: [Patch V2 1/1] UefiPayloadPkg/PayloadLoaderPeim: Force UINTN before save Ptr Thread-Topic: [Patch V2 1/1] UefiPayloadPkg/PayloadLoaderPeim: Force UINTN before save Ptr Thread-Index: AQHYHirBNGFdAs5+10G20yJR1LwUUayM4G4A Date: Thu, 10 Feb 2022 14:58:51 +0000 Message-ID: References: <20220210030302.2016-1-guomin.jiang@intel.com> In-Reply-To: <20220210030302.2016-1-guomin.jiang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.200.16 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 20d716c7-25b8-406d-1c59-08d9eca5d998 x-ms-traffictypediagnostic: CO1PR11MB4787:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rKh0c3D/n5YZL/GK242ccMsnvQAQ+9qhc344xf3kYYMHF11gnfFfWuhQ15mjMSgDit2zfvPx14B3IxpPnyIEr5rfM1Y1/mfASyMe9GBW2yTu/7b4kRhSpMH799ABQIp1ES5zVdR465QfHVdO+nAlthfhTGWPu0ltIHQEHeUtQJPhTcTUSxXBnKVnr4BWc38FDk7HcyzLT0uhL5K2kwRD5/eVonf7zIPzTwaT+CdGkBqirRslm0Wnz3oVDyPqRDCzOfTyBwmej2sQEy7jE2M02R6I8brvxDXOl2RMGLLl1GkFHbajMsiEPBjQ0QnIBu5boSZQ8O1nfCpv7EkVLNsHgA/Ozp4ZmyV1SiFaqzdr+Yd6aHAdDmSbKazv27LNkup62OLSOmqLA5YexhnNzr/P1WCWS7M//h5Qn9XXZ5ZHLa9cQzKQ3o3UOLTaQrVrqCGaAbFUzsEeIwFZNU3F1l5CS99JLTJtzBLlr6i7jCRdrhPMm+y6w0VqXTLgIUCUv4zaLlZEj0t2F1U5hpMm+1oHPhsyZW23jNdHgBRlPChOiX4mEs/C0zhYEMRt9YTWGs2S4yIaADGmwqHBUUJnldSIijuGOc5aJts+hmEMQZ19XYVr0zEVm5oR7zrUjVANr4Czt7zDmKWbiHhJsjhLvFRhh4qXZ5heYR/2JtdqeSlynTrVOY9d1obmwRv5RnAcI3EvzoWNsepGVb9BhP2afkRw01lc4Esh8qOOBltF7pp0Ct4ZbijifLuRiJwLmjylIDYndEYqgiNlfPuiebchKwfSCrBMz0qUG+BssTj5wQpetiQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4945.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(53546011)(19627235002)(110136005)(9686003)(86362001)(7696005)(26005)(38100700002)(6506007)(83380400001)(107886003)(186003)(122000001)(82960400001)(66946007)(8936002)(8676002)(4326008)(66446008)(66476007)(66556008)(64756008)(508600001)(5660300002)(33656002)(76116006)(2906002)(316002)(38070700005)(55016003)(71200400001)(966005)(52536014)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?V7/tCIaMQR/vphTIry19ncjqs03O+DyIkOLa3vaXmxeXf5CMcv+7zavCIQ81?= =?us-ascii?Q?B6EH1QtKBslb+ikvRrrH1JxEqBWa0VxUlxVDM8f//3jk2TjKEEbe32EPYQtX?= =?us-ascii?Q?11ZvTbVSKXm8L8amQvNoAWFZlC0KJ3YVemVWg4v7Oi7V4Ss/FhWpVWJ1618f?= =?us-ascii?Q?IJQdkE9DyVibovMUYowLpXLkLJpdfCLIcav7PYFJDFMYYNjQRmjfLFZ9q8t3?= =?us-ascii?Q?hRnWJ9Dqj62XGMYcvlAslZzDIgiaEoJ5ZkFKH+qazOuRt7biGKvnMuJRlgAE?= =?us-ascii?Q?cOQYXkAYEYdyd4S3phjMGJmw61891i4gxSb8XaOvDaJoyH6qazEvGckGS5xz?= =?us-ascii?Q?MKs/lSoBNTDY29a7wSCrWqyA+B/mkY/hIn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GCY0Geun2aT6vehFDpXRfIJmF/whqqkGhXy5qbtp5Ji58R/8?= =?us-ascii?Q?99DZZ0fvNBrb4eAABjPDC01aI32WDa30VlOP4sq7GEXhgYs5fTrLWw9NEv7y?= =?us-ascii?Q?+v6C/oP6AbAbsiX467srBHTgZoWp5mgv3ChzWIg3xkA4orfGReeIaWxfPfU9?= =?us-ascii?Q?mJ9/MUjItt36PJbFjGQ/ulnPrbu2av3IAlOlqL4Ybdok/1Y81StFz//DyuWK?= =?us-ascii?Q?heP+x6HVZjK+uV8G+uUdsSLVYe/k4Jzer88Kv/bBa1kX/++ldUJ01bN17TFy?= =?us-ascii?Q?Y0WPmOsjP2/4RjQ9w67Kow80cXX5Te62AvbOVyPx7wmfRhGbeJD/AWY3+vRi?= =?us-ascii?Q?bPmvu4SI4bfNYhKyEByQjKk=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4945.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20d716c7-25b8-406d-1c59-08d9eca5d998 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Feb 2022 14:58:51.2613 (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: DPtAJHaaX3TQ1osrfvLLy2M/FjUPV+xHFzvsDr/Fqt+fdD0rrhh44iNFuNufXcpz04gs4hghI62LNi5fcc/qKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4787 Return-Path: maurice.ma@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Maurice Ma > -----Original Message----- > From: Jiang, Guomin > Sent: Wednesday, February 9, 2022 19:03 > To: devel@edk2.groups.io > Cc: Dong, Guo ; Ni, Ray ; Ma, > Maurice ; You, Benjamin > Subject: [Patch V2 1/1] UefiPayloadPkg/PayloadLoaderPeim: Force UINTN > before save Ptr >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3818 >=20 > It will have some potential issue when memory larger than 2G because the = high > memory address will be fill with 0xFFFFFFFF when do the operation of UINT= 64 + > INTN. >=20 > V2: > 1. Force the data type to UINTN to avoid high dword be filled with 0xFFFF= FFFF 2. > Keep INTN because the offset may postive or negative. >=20 > Cc: Guo Dong > Cc: Ray Ni > Cc: Maurice Ma > Cc: Benjamin You > Signed-off-by: Guomin Jiang > --- > UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c > b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c > index dc47a05c6e4a..68200fcadd3f 100644 > --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c > +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c > @@ -143,7 +143,7 @@ ProcessRelocation64 ( > DEBUG ((DEBUG_INFO, "Unsupported relocation type %02X\n", Type= )); > ASSERT (FALSE); > } else { > - *Ptr +=3D Delta; > + *Ptr =3D *(UINTN *)Ptr + Delta; > } >=20 > break; > @@ -177,12 +177,12 @@ ProcessRelocation64 ( > // Calculation: B + A > // > if (RelaType =3D=3D SHT_RELA) { > - *Ptr =3D Delta + Rela->r_addend; > + *Ptr =3D Delta + (UINTN)Rela->r_addend; > } else { > // > // A is stored in the field of relocation for REL type. > // > - *Ptr =3D Delta + *Ptr; > + *Ptr =3D Delta + *(UINTN *)Ptr; > } > } else { > // > -- > 2.30.0.windows.2