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.24441.1649642724534296649 for ; Sun, 10 Apr 2022 19:05:25 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=UfIwBZJw; 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=1649642724; x=1681178724; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=O6ty/iZlpZYWKCfCbPm997GroBP83GVcVo9kA3+zVTg=; b=UfIwBZJwUYZj83J2SWNn+g0To3sNZ+njNNHa4BiTqVNZrzkhBhItm8Zt n38Gg+Mv+mEyqUMK2Bt3BlvBZNPEXPOqRJSIw2uqqiBIJjRrl8eh3gBlq lUc0iUDeBuxfTqdJ6jiWjHqu6K4RT4ACE/ym9ncmdybFJJOYYHmds9RaJ 43IfAPR7G/48efXrksp1qVOUxplBfq6D/GM1t024GLpf999EvjqlMjJAL ynHcvXH0upDaFI0b9joHgNNFu1PbvAqzLMqf3FqWrbc/SvQG8ytjkVtei Rxj8+mqRZpMywSk1b0sEmmkQMThJt3/yKbtFSe5BYcvUGj2F5EscqwWfZ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10313"; a="260860663" X-IronPort-AV: E=Sophos;i="5.90,250,1643702400"; d="scan'208";a="260860663" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2022 19:05:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,250,1643702400"; d="scan'208";a="571906461" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 10 Apr 2022 19:05:23 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Sun, 10 Apr 2022 19:05:23 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2308.27 via Frontend Transport; Sun, 10 Apr 2022 19:05:23 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Sun, 10 Apr 2022 19:05:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KURhfoWrtQMILyUHM0txBCDl82296mCF+yiN67D4VyRgjSFuSZTzWMgd1bwUi6QPJrOHhCODCPmV4EtKtE/pnbxu7eqpaOAaK4ved1wbJp8CPCupDLhaid4dhY8KIp0LRewMQbqVGmJ+P3p4kTpcenhdgfDWNrs3n7VTTQjS/lfTdZAnGYR11+4q9JX+L0Rtq600iZVpFArOAU/1TduGuOzG1VYnv9VRfrAT89yg9IfdvOU74whNH9wietdGxJYCDJkHu0/18POBJTpuTSZU/bs+R2A+rESaPwhTtfElxASqjppqJL69OpyO4d31AIZPHwI5oivrjRWyqA9tpPLtUw== 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=O6ty/iZlpZYWKCfCbPm997GroBP83GVcVo9kA3+zVTg=; b=EVUJFFs0ANg8kS3mEBsqS6C5ENzfeHTX3BG+0kyFcr2qpdHK1iVZr0o79Shv3ZoKVclryTeUGQmRO+EKhasrlvgx8/7EMeppBT0IgaJ/d+eECJ4aS1PyHlcU4skb8X7p1o6IXoJ8QGuQ7B7zGJn3vUcMhOW/qXH3Dgv6CFQ8LuxJ6tRGv4vCYrZvt2xiEu6vf2w42HjDc9B2jY1A16H1t1/NKR4pVcyWoffR8MSYsLcZ3Sql9BsgclTVyAMXzY6YUnXHWgU12blmjI1N3DXHTs+JANv/REXWjM0fh8PlCkANpKhQaLsrvwwrZlrKJk219ExzcpyGDHMmxYaOtb3jAw== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by DM4PR11MB5439.namprd11.prod.outlook.com (2603:10b6:5:39b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Mon, 11 Apr 2022 02:05:20 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::a88a:3f13:4d9:3127]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::a88a:3f13:4d9:3127%11]) with mapi id 15.20.5144.029; Mon, 11 Apr 2022 02:05:20 +0000 From: "Ni, Ray" 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 relocate in some case Thread-Topic: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in some case Thread-Index: AQHYSb2CnXv5SSZJCkyiwm/Oz32EhazjkvTQgAANSbCABl1lIA== Date: Mon, 11 Apr 2022 02:05:20 +0000 Message-ID: References: <20220406135155.822-1-zhiguang.liu@intel.com> In-Reply-To: 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: 629ad73a-b958-4e3f-7506-08da1b5fbb20 x-ms-traffictypediagnostic: DM4PR11MB5439: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: ayCmr6m6DkinNBgTP64GgJ75J35r3s7w7i73KdUEOKTea/ClWvVbRJv0XOfJotSRq0Zl01LvqGM4/blKOquaNaKjYlzFKf2+J3EEoWQMYpU1MlI8qDO4FjttD8KyvYpq4VEDj0/EZFIUWIbR5YA2ffL/I1e/+MzvywZtbzNAJPmbW9IBOYptEUXQETAUGGBb7YqcpfxqnjMlMrmm2QX+IxbMS49v6pEJD8mqNAkVA8dB3wHdfrG/+JpCmxSL0utAxYyVRzQq8ctxGBLwwAzTztTknaYip9sXT/yCM/axSXcWEmwuYgz6fQykdgj/EWlzi5UOh739oTtxak6FyiPziuCAec6JOQl68U3Xh4+kkxxfQNrFv+2IcPZXcDixUzNl2QnclIdoBHLe4NcKgUR3uT8qdiPfGozhxOm+5He+TTnOxhHTQDBgRx/i1BEKKAhOKwX9DZ61L4BehY/TXdWuDZGvbeaWPUmyJg9wQ4j84jqLW30AHwFqzF/+6oULSYV9Md1aUnWznquN0YM0VuiXTbCXwVWR9HsdB0QSpn9HHQBHQGcXnG3UNU25zwVinE9352bV74ya3El3FI5Uu0RvugkMbQJXS9DyAZFdrPKtVAxoI67SmdKjFybhiyfPJUExuGst2TQdv2n3jcaXcGG1vDTqakVZCd02MxszIK/Qk29DQE8L2rwZL0My1ZFw5zb066273xgK0zAZIok9aRU6mA== 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)(83380400001)(38070700005)(8936002)(186003)(26005)(508600001)(5660300002)(2906002)(55016003)(316002)(76116006)(86362001)(64756008)(66946007)(8676002)(4326008)(66446008)(66556008)(52536014)(66476007)(110136005)(54906003)(6506007)(9686003)(53546011)(7696005)(82960400001)(71200400001)(122000001)(38100700002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jUaI6vLZDlnyM6j2hzLkFgQ8Ua5x/24IdGmNguxAuxh4GsR7peR1t8SzFq3k?= =?us-ascii?Q?suqC6ALnm0qTJ/cTEjIrkhPy4KuOfoQYD5J/7H8nNWhzZ0g9Zn6p8xzsV4Dq?= =?us-ascii?Q?5P7alk6vfVD40FeNU+w+593/FuB5aqgnBiREQvwxivR4LLy3En46wwltrGfm?= =?us-ascii?Q?dsPrda9tOB+5qB7ILziSyP4xsKw2EP7keFG5kk24p9Rg7DTPGwV057q/XUFb?= =?us-ascii?Q?i3Wocpijj2Z4VqgjrYcx4xUtAaaN3WACoOvcxe4MRkvQF2OGiVUjfOZzPUlD?= =?us-ascii?Q?R/4rmS5+nu1/Lo/OqS5pfo+HqCdDvL28sgkqs7xxmL+S8kIjgrwoi83t4FQr?= =?us-ascii?Q?wmi+cla3Ewyu+nfLUDs+CxHQpT/YfxzzD9GGHjQr2k4hR1Re51LUSPur5rgV?= =?us-ascii?Q?MhUN5lty7WkviWU+2YQzdeUbHrHG1pN8yNdqsEQBNA2APIGgkNAT4JoxoZXh?= =?us-ascii?Q?d08USZtN8/IpkuTGUh9kVCILHB8MNx/BuxfX7zTUwVbR2/BEG/WPvJpsDGmy?= =?us-ascii?Q?6hxZCIw0bWBSSwLDoEb83M/ZFS+mXN5D5M/iRFv14DhP3DoA/fILpzgEPkJ9?= =?us-ascii?Q?yEC5JGLP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La05L+HNWKY?= =?us-ascii?Q?M2BbXIDgnaKh+fc32fwaI9eBhYxET8Pt+rD8uhZbPzPSR1c6TT73TAUY56gO?= =?us-ascii?Q?NLxrof2fl9/YniYsuEl+YNdSDeFjyDFc0pRr1VktAN59YcpPOQveenSgJPMS?= =?us-ascii?Q?LZa9RPxPNMFK6yPrFmuKykaYZrF2QtoXHdNPWXD5REJoBMsqDeU1RACzju/h?= =?us-ascii?Q?Ho9KukJoc03gOqFQd+2jgK058+fGYR7mXZCm6L9slH0UoeJ0MeP0mlBSOKGp?= =?us-ascii?Q?yGIks2iO4g=3D=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: 629ad73a-b958-4e3f-7506-08da1b5fbb20 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Apr 2022 02:05:20.0874 (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: +Jhgu0RI16aLElCP7I+E/UO8wCq9WbugKilSzCvsvO6pKNjfNhq9TI5Zi5PR+y1C4Ul4a628nAICZoRr4VmVuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5439 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 With the updated commit message, Reviewed-by: Ray Ni =20 > -----Original Message----- > From: Liu, Zhiguang > Sent: Thursday, April 7, 2022 8:57 AM > To: Ni, Ray ; devel@edk2.groups.io > Cc: Dong, Guo ; Ma, Maurice ; Y= ou, Benjamin ; > Rhodes, Sean > Subject: RE: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relo= cate in some case >=20 > Sorry, it is a typo. the example should be > The first segment is located at 0x1000, and the desired address is 0x2000= . > The second segment is located at 0x2000, and the desired address is 0x100= 0. > The current ELF loader may copy first segment to 0x2000, which will erase= the second segment. >=20 > Thanks > Zhiguang >=20 >=20 > > -----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 re= locate in > > some case > > > > > > > > > -----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 + fil= e 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 desire= d > > > address is 0x2000. When we parse and try to load the elf file, curren= t > > > > Why the desired address for both segments is 0x2000?