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.web11.1261.1649293034957286082 for ; Wed, 06 Apr 2022 17:57:15 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=c2a4dFhK; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: zhiguang.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649293034; x=1680829034; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=CmIA80VmzOLxfufTAL+cLSlKC/gD1wjv8wYryTTFoKA=; b=c2a4dFhKH4o1AdWW1NjDkyTKylc/SivBqe7p9200fp66unke4P3+aj+a kSjCwqV5bk307e9QWw8EYESqQPDN4+ePXPYC+FpwyyER64gXIWV1C4MZx q6AKvEEt8ltxHlQCo0dkgSkksvcmnQSGVu1x8PdR5jYhy6b8sa0+eR2Bd eC/cBqRYCzy3eu9Wjuh2hXCHalc/CdjkLZz+oxb7mx3/vKGojbrNzWDN0 eMOepG1pr1T4TA704oU3Wr5Xh0Vl4V5b7vc78oYInLvLLr1N3RcuBX3oX GAGMIRoVOA1vMk7p4APi7Wi16QoquM5pyb+UNU8IVgpU/Zxgc0fyaJnH6 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="241787998" X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="241787998" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 17:57:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="549790676" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga007.jf.intel.com with ESMTP; 06 Apr 2022 17:57:13 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 6 Apr 2022 17:57:12 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 6 Apr 2022 17:57:12 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) 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.27; Wed, 6 Apr 2022 17:57:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZFYWufeSh8KTe+vJN3gtiLR2i8degwrzPPtFZQM7UYLvWxuXNiVutqPdMivkZ8JI/qrCMxb7nujH69nNUtQVXwRIR5c7vPabLJIreL2vkgtbGTmDyJEmbb/NxnX89M08ZUZSJ6sk33P/N0IyrNxAmXeCHXnzUlLBZ4NAS3K/B3fKiQrNzUAR8bryWqXhSAGIRocwPsaVzJ0t8srdxCr/n327Ce7aCmnZ4DVTgP/1q6h/Qe5J9qvRufi5+jYcWe7gpYJBg8r1towG0k2LDQMDi95hpMfpkXlNWPzyTKQ/wHmtzEnNBMshOACG+TkN5XSQBPXE0wGBKEi2nwUtNU6yA== 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=CmIA80VmzOLxfufTAL+cLSlKC/gD1wjv8wYryTTFoKA=; b=kZKEiqpMHyS7hrcTXx2jfBbnl5NIDANchmDImw1qp87R0Vye53EEtESErDz7bDB/Hr6ni1vp85q22pPqoEoXBB+AlK0c/9Yz+/lt4X9UE4+XdDQIQ83wGg2cFezdTq630DTnFEdWeUyt1y/eQ9IC0cf9bP4L6E4z729/rw2S6xug/pwdv4f9cuvfz0v4Nmu8uDRjN/N2aWrK7Lls61XnEls4BrwORV+EL+zIFZq1R8vs0WrAddXn4VFaUR1pjcm9dV7piXE8iczAPggLVUbkyM6EoeER1kjpgjsODGG2kAWImvcKzbwvjbbqchpvZgALSPki1WXBYBol/8SbHqH8Fg== 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 Received: from PH0PR11MB5048.namprd11.prod.outlook.com (2603:10b6:510:3d::14) by BL0PR11MB3219.namprd11.prod.outlook.com (2603:10b6:208:61::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.21; Thu, 7 Apr 2022 00:57:10 +0000 Received: from PH0PR11MB5048.namprd11.prod.outlook.com ([fe80::b93e:8ef5:9895:cecd]) by PH0PR11MB5048.namprd11.prod.outlook.com ([fe80::b93e:8ef5:9895:cecd%9]) with mapi id 15.20.5144.022; Thu, 7 Apr 2022 00:57:10 +0000 From: "Zhiguang Liu" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Ma, Maurice" , "You, Benjamin" , "Rhodes, Sean" Subject: Re: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in some case Thread-Topic: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in some case Thread-Index: AQHYSb2CnXv5SSZJCkyiwm/Oz32EhazjkvTQgAANSbA= Date: Thu, 7 Apr 2022 00:57:10 +0000 Message-ID: References: <20220406135155.822-1-zhiguang.liu@intel.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.401.20 dlp-product: dlpe-windows 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: a3980d2c-9d85-442e-9138-08da18318bd1 x-ms-traffictypediagnostic: BL0PR11MB3219:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lHt65bF+X/nm7mTLNMffhqWGr6beBfMou+/XptlcGZvAFPnWFdnc8L/h+2nDku/1Y/oa3XX4eaCcOwREpa+JCUvSfmjWcp7m3jumFpm5Bc3SkrfvyhqHz08A3yfYfU8C0Dq0gYc0EBOoOeMKfnBUjCmCRG5hNuqqVf3WByNaoBGoiz/dkOxT9NO9FM5WW4fgWHp5FFdfm2iZUd9/fO+ARr0y+yZXCGuge7JDEAtZoNTDjwZ2IcFEFLqlWyY18bipIDR4cQ7FqbFD3pcI7IhePV71NW/zViDyHIS4BYYdhKgXJcXzK6dBapjlTgG17Xw6LAGiDQgNd/aCXhnhr46tN3ZF0F4bAwJvY5NxnK6TvXetOoYkQmtXFzJ8E3kW461H+8GiVglmpbCNU6gX0w/5T8w7VmG0TeISULRBkgrVesdtV7/4+pEj/8gl69Sooh1kToU2FI//0WE15HTHCcjVkICToEMpmjbzMaJpscLWnzXBVUX17RMsKRktbFc64t+XIXu7BDIbjhnR4LeIHIc6ti2pHPObYBLElH6jiWy+FLinuMHTEY7uoKS8BDoQZrCf6Z4ReLPDiRAzHcYa1V/BgYArKO9iu+NBZvSvzv2WTjqp4OhkjcARHp3OzV12C2K2KU3IVvP8fY9DPJ4Jsn1QaIa3skABnZfloZgbRjvdyiZO1bHVq5tfV1VagXf1VLur6MwlYKQCuiS8ZQwLyhuFqA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5048.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(82960400001)(64756008)(508600001)(66446008)(66556008)(71200400001)(122000001)(33656002)(66946007)(86362001)(186003)(26005)(6506007)(7696005)(66476007)(110136005)(316002)(76116006)(54906003)(53546011)(9686003)(55016003)(52536014)(2906002)(8936002)(5660300002)(4326008)(83380400001)(38070700005)(38100700002)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mkyZzTpDs9HCgmy5Qqnk0+bSrYFYHagY4rnyEdkHmg68pU3BAkgxkpIZlXgA?= =?us-ascii?Q?lePhSoVGgzER1fujIQWz6lL8c4fMEWTgPinntnfNQg7vEQOF2a6cijyw5EGD?= =?us-ascii?Q?UgOC/8dkVHCiS65Tp6u2ipYTmZW+WFbkk90FtdJuIZRuj83nHcaEN8nHZInl?= =?us-ascii?Q?ElzRED76Qa4FP7xHLOIoe12KODDeSbB8VRzKbeJpPxSuHjf5ZnqC1J/9CR1F?= =?us-ascii?Q?PxBg0xM4kT8CVgphSh7vi6uYO4gJNX2sSFAIVCWSW4OkHnIjkk6KP/G2CG7S?= =?us-ascii?Q?nWidR4u1CCfr515knhQLt/V6cbcPsncjWbLgWp/DMzV3AJA3puABYe0eD7bx?= =?us-ascii?Q?ZOuhFgT8XYw6ANgFoy18Y2rsnvBvs28b/z/B76DxoN3P/Rgtuxvlp2MjMWUP?= =?us-ascii?Q?FlLApm8gEkqdrlCxr/sY68GtfthrkeszL141ebjs3+eWCOj0HmeLDnfmERCT?= =?us-ascii?Q?1Yfwo/9g1TeSxPQ7NRdOxG6GNTNozTzLYcgCCyWB6cc9dPb1Ms2BvHWwrFyF?= =?us-ascii?Q?bp/RxN2h81AdwnNvQBTi8Wxs4gBovb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tVgo8TqHwMPwlV1Pqgnd3AIlnnnCJve2S/FjGvWHFNsUvPsrE8T?= =?us-ascii?Q?aM3KFkORiDyeNPk3ePnN2DbsuYgZrQWfv7js0+4cu/xxSagHdr0MnPfa7piF?= =?us-ascii?Q?jB8/xfnJ8tRyzbdozKFFwzUTJdAw4/H0zrRsbhtmrKz3hWoCWNEZw0vTEJ2F?= =?us-ascii?Q?gWLHp7EZvMFLfM/VBnKI3+cJOHmzcmSMsdiIXMXuAIlvV6xvb2XkfbndWfDd?= =?us-ascii?Q?unqCPDRBesq+x6C7Btacq4zV31tsRIqPullxnC7n6H677Xn5WnEjUkrXY3T7?= =?us-ascii?Q?XEyv4PVaIA=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5048.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3980d2c-9d85-442e-9138-08da18318bd1 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2022 00:57:10.4109 (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: KHmXp+shPpk/sgqCrzbk3ZlBINkMvXLXL3zdA32OOaY3i/M7UYqeNRm8P3L7cxUhoQsC1wBaxG/MngdaAYLYXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3219 Return-Path: zhiguang.liu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sorry, it is a typo. the example should be The first segment is located at 0x1000, and the desired address is 0x2000.= =20 The second segment is located at 0x2000, and the desired address is 0x1000. The current ELF loader may copy first segment to 0x2000, which will erase t= he second segment. Thanks Zhiguang > -----Original Message----- > From: Ni, Ray > Sent: Thursday, April 7, 2022 8:06 AM > To: Liu, Zhiguang ; devel@edk2.groups.io > Cc: Dong, Guo ; Ma, Maurice ; > You, Benjamin ; Rhodes, Sean > > Subject: RE: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relo= cate in > some case >=20 >=20 >=20 > > -----Original Message----- > > From: Liu, Zhiguang > > Sent: Wednesday, April 6, 2022 9:52 PM > > To: devel@edk2.groups.io > > Cc: Dong, Guo ; Ni, Ray ; Ma, > > Maurice ; You, Benjamin > > ; Rhodes, Sean > > Subject: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't > > relocate in some case > > > > Current implementation of the Elf loader reuses the same memory range > > if the desired memory range is covered by [file base, file base + file = size]. > > However, there is a potentil bug, for example: > > If the first segment is located at 0x1000, and the desired address is > > 0x2000. While the second segment is located at 0x2000, and the desired > > address is 0x2000. When we parse and try to load the elf file, current >=20 > Why the desired address for both segments is 0x2000?