From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web08.6450.1644471253478587328 for ; Wed, 09 Feb 2022 21:34:13 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=TwjqaH1F; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644471253; x=1676007253; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=EVDDtFT3/KxYMBmZxmYxpPFJ56ddvAzCjhfqdL2WDuA=; b=TwjqaH1F5BkV5wCoyMEW6zGakN7Ay0AiIyb4AWrele30UbTlgRmshB6V bWTFFpAreOEzCZE6DJTC3J6VC67wBxlkhnUj5yjygUDMtLrbWfAx43dK3 BFlIeQaaQuDTt/LekhE6+p1RFj5JuKAWtqxtrRsm8gzJs0ZCBeuMjhEjn CD7OYiclT0ywm+lShMQD6vzyyfnVVVz6sjRCrF0XzyL/JOPIVuoFnR/gT iDo9qBeIY9FY273awWNNSQ6budy1oClzR5tOLkbklpKOJpS2LEM0abQ3v CttVuSo6mVWjEORds4wYqAaWy8v0tCKouVV3Qj4TAuUBzcWAMWMufmo5+ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10253"; a="248248151" X-IronPort-AV: E=Sophos;i="5.88,357,1635231600"; d="scan'208";a="248248151" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 21:34:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,357,1635231600"; d="scan'208";a="773757397" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga005.fm.intel.com with ESMTP; 09 Feb 2022 21:34:12 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 9 Feb 2022 21:34:12 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) 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; Wed, 9 Feb 2022 21:34:11 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Wed, 9 Feb 2022 21:34:11 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Wed, 9 Feb 2022 21:34:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ImPeBdZuoPPOTr/D7W8rCENSXP0/vCvSyB5C2bN91/CZwlclETYfk6eVn/55gZyneAW5nrVwZ3h02PV43/DjDt43sL7vbiZKokP9bwmBdhTwC/H71wLS67SEsPCKwVfCj7agUfQMvDPSIkwLT0Yy2uGeOl5oHrZGziXwTUXEGvBnx1DCmILyAF/bdaC6AgrXtc+ybloNws8vG2PoYEqHZfsofoFuJpQ1d2vmp67iLygEINyyfIYTh44DlWSZ2x2/l7WhFR2iSqI58gh/x3H0gGE9iWTgSmJUDFkVuzB2x4mbGnw015uMcmINAtfKqLnCr7nQzdLH/IxxQ+fZjOw41w== 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=4GmwA8lW16UNMqehdEfj3HXCKQc6ZebNULplJCuNSsw=; b=jCmsHslI/5BLTv6DBa+G3ZuHc2TFcwQE3cPgvxobOHMuEoxTDiy0K0yHSVUlmKmV8buMS6EFKIQJUQ7pz2oYlGVZguKb7jPa8ug+VTVpyKCm6rGzbeumZR6LDUsJGkNKRfAvQhAKwD+TKpNicj6u30kgi1EH/8A3dTXU8OhtbLBNSXDiQ/T5fhZAZM9oC1lP9vgArm72I9j7136K95D7XfjlyQ/xMeatkLGKDr1mAPe1jq+zD43ML2lnkC9uowuwZlmKJX14rWfmrvDIrunKSMVHhuSeh7GTIJqz3v6ELvn+dmAvFErCHZyPQaHRoqQdHx/UQ548tVusMuqQVS3UZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by DM6PR11MB2633.namprd11.prod.outlook.com (2603:10b6:5:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Thu, 10 Feb 2022 05:34:10 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::e0fb:ec1d:4e67:375f]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::e0fb:ec1d:4e67:375f%8]) with mapi id 15.20.4951.019; Thu, 10 Feb 2022 05:34:10 +0000 From: "Ni, Ray" To: "Jiang, Guomin" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Ma, Maurice" , "You, Benjamin" , "Liu, Zhiguang" 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: AQHYHirBrnf/s2DLCk++8MocKe77wqyMQt8A Date: Thu, 10 Feb 2022 05:34:09 +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: 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: 551d2ee2-70c2-4b79-dd5c-08d9ec56f6c3 x-ms-traffictypediagnostic: DM6PR11MB2633:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2582; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fyVF3AxwxjYxuQwHEb5fKms3A3Y8KajzeiQWKvAtj4LQQbZtaeswl7kPXzDDP7OkaAzj+/dTjkC0gHuvRsoNRAKLvtEBBHUXQvn4p9dfQU2CyPhHMwRI0z8hCqSsN5ggx/XRUqOl0wt/glu0OQkNm8PGYEj2r0DVf7C3/580nS9vH88t3uPTQnLyhJVhg7aRTjLTXtb83Ozcfh9TAXkiLNxvuml5QEwIU4dzjj9iY94/SUBdpnK1tvcbTFPfPVTWazlv61CdKGmDQMRguQy7YdU8DJ6dKCEdwJr5kSYkXWkj/eVjJDW1Sx3/MpYc4phP3yshep/PRcXgheV7mSQJzRCA6zwIxI8fZAVAiWDgi+THp1/kohPJ7hhCn/vgX3FtWwMAdqX2xjf2JMsDZrKAjKr1G18rddbGrWbh9hIEi0xOLHUniU+hr7c35OEG5EubIb3tMugCb/13vF2xCeSANabtq3hqgxxxSLkQ83Hcjmi2phsWGk+ilgd/8VoaaZdZycsBLpnrT7tpdIHNJVK8yHvesnFxFC0gHaQcWMZzkTCmaIajY4p8llup6nFdMDLeGTS1cwCay/h93w1/KCJP+GaZ+KUMZD9Vqqg4MahoQe/qQFmSKpfFQBW7KfiITT3cIo8QOSSLZUlJxCxmCrJ9ATOScpLdbYBemNMk0m5bE6d20/0surpVU+YI0lyHGaDzZlGBAWdK3ieOWfcEPknaqtdrmxLpNuySvWJ0kBeXlEdyL4NdiVL4th6s2SWr+Om7kzBAJikMIhg5mPevLXiFP0SPhW2vavO93YUtSp3B1eA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(33656002)(66556008)(66446008)(66946007)(64756008)(54906003)(110136005)(66476007)(38100700002)(966005)(8936002)(8676002)(86362001)(508600001)(4326008)(122000001)(107886003)(83380400001)(53546011)(71200400001)(26005)(2906002)(52536014)(38070700005)(76116006)(316002)(19627235002)(7696005)(5660300002)(82960400001)(186003)(6506007)(55016003)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZOYsTiIM/HqbIO/eVtUzrUAD083csE7MWBnEHmyB/q1iobePwk87+b6xKkc2?= =?us-ascii?Q?TyVRvLVuBqI4I7b/YKotPDWmpYDW3c93xjBlF5fwsuKvrkEQObW3g45QcNEc?= =?us-ascii?Q?P4E2EXEKMyxXKwPEAiHqX5KxuacVvyQE1KK8Gn22FI0OjCFIdCkWKZBQITXw?= =?us-ascii?Q?3AUXnZXRw6hr6AbT0U2dGkkASBlvUTlNdfZVOUE1on2fOan0loDQV+xiPe8Y?= =?us-ascii?Q?OsXYEMym0sAl1GzTZHb0JRAvN+QjXZ6pJ2MqiAj/2TUGWEYwKXCK6iW2DpIk?= =?us-ascii?Q?ypoh8iGdtV3M4RMuj6TCO3OgbllOvw+P4FR5F+8zcmv82SOhpRXx3DbGHZjx?= =?us-ascii?Q?WLqHSD6cPc3AgQ/IPgPyoO40AIQAKefSvCTIt8nPjeZPwaP0O6oOkI77bACp?= =?us-ascii?Q?QLLsMUDlNKeug0LBCJ6aoBGOAW838WH/HguPDpBSWTLukLjJDk6/ggZwawca?= =?us-ascii?Q?zjxnnKlKzHIPkAVkEhKiFvbzfPyD6E4SG6s0o60TRB9dYzaufLm7BYMQqdDv?= =?us-ascii?Q?FyR8fIWcoyRwMXCgK89Uv2uFUiH/foNeR7Uki38vajaIxpl1goq+hg5argVt?= =?us-ascii?Q?sXmOCqFtm8wV0ILH7NamnXkLQn0J36QTHfSjrECvKzbEZQlzDQX5wstXdOzT?= =?us-ascii?Q?FIa2R2zPXWFkoR9UNqv3AReKNsFd7h/Q7X7wIVrq0If1B3WGyQI7mJvANzUa?= =?us-ascii?Q?U6oo6MLMi5E6uzDsEjI9mw+Vhx+gjeSDQuZLg4IH4l3LaReOJWxJTwhbc0Pa?= =?us-ascii?Q?pGSkw89OD4tf1mQO/Ie+o3hiqSaec1a6IuAuiOx365RzgcFgpuAiaMUeZctd?= =?us-ascii?Q?mmUFVw12DXg/zk/GMxgaURf1LjdqQQrDIqN3uNH6LFdxteBoE8byPMBN+7Sv?= =?us-ascii?Q?tYIKakghOAEZqclGO+FNV6D2CM9I5+jH8aO029sfsnOQ0Btu2qUBA6+TWST6?= =?us-ascii?Q?cyp71lAlCJiy6PutBNe5lHIbQykYlCogYcrecZ+TyIY3X+/+UxEj+uNQ6//m?= =?us-ascii?Q?736/1P5BikroksWywZQvn7333yedp06F4QXjkABT9+/faOYt891cEyGJp/VM?= =?us-ascii?Q?bQJdfh1NhI4sZBQua6zHp7cEos0poaS+JPAq4a7OO7OzfFd5+VeMLpzCMlYz?= =?us-ascii?Q?QPnOiC42ep0me9RZhcAEikmBEQ+WGNybWN8XDIbyCjxHPDbRN3g8Kq3XhPJq?= =?us-ascii?Q?HKlkSRPzETfuU7UERo2j/6WvNoLL/F9a+gXOprxNy0Qr8iVGTgE0FxuseeTa?= =?us-ascii?Q?Mwlq7E2tMwH+VGoyg7qZbnY+4mayBRaKHCbM+PdazWPx71dZMCFufTG8RSUL?= =?us-ascii?Q?T7HXLCAKDN7UwX7wGCvQQnQrxhCOypTqRjMDHCtoVLmO63LQFJF97vGVfnnh?= =?us-ascii?Q?SArXPA4ZsPgA89ZWNBeHAvJLOhl+da7nEn+lbQcMzwdgEmjq5C7eIGgIeq+I?= =?us-ascii?Q?aKQzPU69hpSfL/uZIo0itOwSRW2DSh+LBCv4fnf3AbgHlXNbjY8/1YSl/Dth?= =?us-ascii?Q?W4rXj9nOL0GLXdnFt35rtSANFfCeRh0tjE24eoDWSjBYDqIXrXbjnJiBv6ln?= =?us-ascii?Q?dCvSLZWldiLT6E/SxKnflqn+s3qMYGGntHXtcNrZOaUIq+MNlq/7Ck2BCyac?= =?us-ascii?Q?N3PpEbC55L04SJkm0qKV5tI=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 551d2ee2-70c2-4b79-dd5c-08d9ec56f6c3 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Feb 2022 05:34:09.9759 (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: +gHtcN7TkAbof6INlI69F7EX9+gwjaSuIUxwVvvgjEYrllb+Du7KQpv9r1hHbXvjIYGEKymc85ZEPyEtAo2E7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2633 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni -----Original Message----- From: Jiang, Guomin =20 Sent: Thursday, February 10, 2022 11:03 AM To: devel@edk2.groups.io Cc: Dong, Guo ; Ni, Ray ; Ma, Maurice= ; You, Benjamin Subject: [Patch V2 1/1] UefiPayloadPkg/PayloadLoaderPeim: Force UINTN befor= e save Ptr REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3818 It will have some potential issue when memory larger than 2G because the hi= gh memory address will be fill with 0xFFFFFFFF when do the operation of UIN= T64 + INTN. V2: 1. Force the data type to UINTN to avoid high dword be filled with 0xFFFFFF= FF 2. Keep INTN because the offset may postive or negative. 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(-) diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c b/UefiPaylo= adPkg/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