From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.13159.1686751661026408973 for ; Wed, 14 Jun 2023 07:07:41 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=lZpMs+OE; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: brucex.wang@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686751661; x=1718287661; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ePaJEoxrNh3QqCrhnhkiiBJYpVs0ZPNLoenOE7R6Y4w=; b=lZpMs+OED76a3vjBLJRyYujnwKkqPOVKRtAXESBWvPkLVpuTimppPXTU afxkkQPpLYFW5DcwkFWQSMXu9Kv/BWUpNHF+vKfFKqUDDORPxdca60/qM yfKtwevgkoYyAUXbqwUo4y61lWfewPUB0a37nSB+tUb4HsIWP9JrlexyZ DS2MEZXmZoobjgcqogRHMCvZ2gxRNs9/CWIrx6zw6RVqVswMxJALii6mc ftNbTCIxnZT2SAp40nsADay9tw25q8VxbkCUJ+VnaCqTruBam2CYEMHby WvAdEOC8/INjnpPMHV4HvIWuKg/BPPGo0xyPCR9Y+S0QVx+5WI8msve55 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="348279846" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="348279846" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 07:07:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="745090993" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="745090993" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 14 Jun 2023 07:07:08 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.23; Wed, 14 Jun 2023 07:07:07 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Wed, 14 Jun 2023 07:07:07 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Wed, 14 Jun 2023 07:07:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UTugItlcez3crChoqqrX9MD1HFrXc4set/yYo23N4/Li+fHMnMUcSlUVDCC44aS/AQDAYPwcRXve9le21mMp7X0ixXH5+FOLARYsVP785Bh+A4QjolPWwLFDDD413l0+cN1UVnKgbqUM6aKzZiyqR7sU2G66aMwXz3IlP0TaR9r3OiEH+Mq4Svls6uFMMq6kKdj9wa+Sy90fLILfgRTYkEXTjeWVpXD74pvk1q6KGcU5Dr1hb9y4iOGUC2Y01hgFLzqyA3HPikFt9iTi1XToYjqZExawqbJex0T9h5eYzFC3WG9Kt7640zlemO8KueyCp1GTD8IbnZ7wDA+e5OcEkg== 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=IbnIvIdW6jUnsDnPMqtHNMRafaAtUbjrnvnF7YC0ZMo=; b=P2NyrRwQiOYMN6Rbi4wA31csWZuJWJOs0iDzcoIKU9w+qPZca8mWRyTB8tq+cRG3dvaAbpajnYIjxfDjHYpNnkwXlmFZ6IjHCcjIPl5A4VuysBTrLPuiXwCbvkrLfWtbC07pqpBDCUPHp3oinoa3qLZ1001TdWqwfj0YnMNazapY2Sf+83izicBVAM3J69x43bKxadegbAD4+ZdjBZM1zMxtofqgNjYuzet8XEymc0itVZFjqisjcjMRF0vTWKXpxTV0IQGb/eVI9n12FxT03GdYpv6Qid+lYFQ686wD+pSU7aooF2opeAmvzB9z4+Zz3FrLt5IHQ/dfqXeEDTMUkw== 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 IA0PR11MB7883.namprd11.prod.outlook.com (2603:10b6:208:3de::11) by DM8PR11MB5672.namprd11.prod.outlook.com (2603:10b6:8:26::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 14:07:04 +0000 Received: from IA0PR11MB7883.namprd11.prod.outlook.com ([fe80::5a25:515d:2fb6:c4b6]) by IA0PR11MB7883.namprd11.prod.outlook.com ([fe80::5a25:515d:2fb6:c4b6%4]) with mapi id 15.20.6455.039; Wed, 14 Jun 2023 14:07:04 +0000 From: "Wang, BruceX" To: "devel@edk2.groups.io" CC: "Dong, Guo" , "Ni, Ray" , "Rhodes, Sean" , "Lu, James" , "Guo, Gua" Subject: Re: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader Thread-Topic: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader Thread-Index: AQHZnsif9PAXO9O8vUmbaUgQvlhOhK+KVShg Date: Wed, 14 Jun 2023 14:07:04 +0000 Message-ID: References: <9d76dda748aba4b4614d99227d225c87157c5f84.1686750331.git.brucex.wang@intel.com> In-Reply-To: <9d76dda748aba4b4614d99227d225c87157c5f84.1686750331.git.brucex.wang@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-traffictypediagnostic: IA0PR11MB7883:EE_|DM8PR11MB5672:EE_ x-ms-office365-filtering-correlation-id: fc288041-91b7-4acc-8d5c-08db6ce0a1e0 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TXb22+lbyCPTA6z+SRtp4xOlfLqh83Et8sZypZKhwMw4OOVt64EWiq/1N1toB7mTV+8lGFiwU1x5B2OmtPvfylJXloNKKgNP5PCaSCcbykqp3Z6DF0kF59OaokBlVdfHtL8vBveXW5G5GCIkeegcrkJ2u6wbPtWHXqWlEy4F1ETB7Ga3hjy+i1lYwffCmDXgXL8nUWvWhxzBdvow2OyrvhVSW74d5bKxHOdlBmOLO3MAKY1GrqsoYonopIr5MWQ8FNv3PrmBIueKEevybRrI50IqfoRXm9FrUTNrfBEeei1WsS9qZs30UWrvKAOCm/9QIPuPwopx9Qrg3o+2WBGUO3mJuI0kb0Bsr3PzxIb52hbnnVRaQc/+HCdTjCzKN5Pm3wprZd4Jd9OZAJ/cwSD3rATlSkhnDlR0mXawGDaXnMgx0yH7t4r7/iAC4Lz0K42SBrCD4wREYUxAF3A/xZNUQahinRUqjw0ueuoUCOXBJXIFry8e3cqL6sdL2eGOSSn4PPxl8OgPiSn8AC481dlMsDNHdkYFp1hnXWbeYP4J8CmzBtONzVW1RcMs+t+fMgAo93w0MIimywhP1Re7WEHZ9du4zipgdQjABVGMkA4pIG3M8mZByk06V4g3ZKwOtqAs x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA0PR11MB7883.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(136003)(376002)(366004)(346002)(396003)(451199021)(71200400001)(7696005)(478600001)(33656002)(53546011)(6506007)(186003)(83380400001)(26005)(9686003)(86362001)(38100700002)(38070700005)(107886003)(82960400001)(122000001)(55016003)(66556008)(66946007)(6916009)(76116006)(4326008)(64756008)(66446008)(66476007)(316002)(8936002)(8676002)(52536014)(5660300002)(41300700001)(2906002)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?LBydOc2QObcmKSRmYVxWbjCKghmvELIWAaGHbHCDsESw5wCrMvC63FKdtecD?= =?us-ascii?Q?CQ4G6BD0ZiJew38cMgk65xkgbJLdRmoRk2ty9cXTAmPJ1XTBGhYIhRqgQwks?= =?us-ascii?Q?4v13htHsV4IDA8v3am9I5sxO6wJGX1LNdIIhn+3q2sjcbktRUlK8Lk1xtI7f?= =?us-ascii?Q?y15gPddrKtYQAG3EoIoVQkQrUDAwTTqsC8nMlJ9oieupoqabE/styJoU79tL?= =?us-ascii?Q?5bS3MlGPvCopo1N0Ka+NRZC1pSbe7EGzfZz41CXfcTXZ1bbWDJJORS9zEylV?= =?us-ascii?Q?FZ3HV36flWoG1JxQrqq8a53wVr5Vm2dziPzoEEB4ykBv6nQNNl06DAHtRrUh?= =?us-ascii?Q?SmPo72mAOawlhUrM2B/U+EBcL8uLsPHpITVY6XfEvTbpru/iNO9OyPjN8PB1?= =?us-ascii?Q?IIajpyQQ8F9tuSF94t+OOVgKP047x0EK2ckQJ0QLTcja45JLVXhXb+xC4N/3?= =?us-ascii?Q?lOTEBrtA/FQaYuJmWuQmpqGCiO8dh3Wq00jrWvJFeh6hMFb+bHtjK2425J/X?= =?us-ascii?Q?E3l8glbAK21fRjBeuI50ZAKZNrPeEbpNYtvInRJYEft+RmjJB9Stky1GnILt?=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CflZwPe0d4HEm6B8NHxecuGGE0dQqTqxVZe1rF9?= =?us-ascii?Q?x7rBWeSsxy5/G7u5ocoudbBjFk4gj37OVBxztLVBcTeh43YN7veixlF8kmEV?= =?us-ascii?Q?aai/tUlxUt56EKECiP6RrelME0K61BTn5acpr4qn?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA0PR11MB7883.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc288041-91b7-4acc-8d5c-08db6ce0a1e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jun 2023 14:07:04.6946 (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: N95fIL9aQWBdfykfxUbEnwz2MvV0U1nYiRMUlfB1DXVvel1rjrX9MEfzWGv2KvCtuKD0glyoAzF950nIEu4H6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5672 Return-Path: brucex.wang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable -----Original Message----- From: Wang, BruceX =20 Sent: Wednesday, June 14, 2023 10:00 PM To: devel@edk2.groups.io Cc: Wang, BruceX ; Dong, Guo ; N= i, Ray ; Rhodes, Sean ; Lu, James = Subject: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader From: BruceX Wang Fix incorrect code on AddSectionHeader32() and AddSectionHeader64() Cc: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Signed-off-by: BruceX Wang --- UefiPayloadPkg/Tools/ElfFv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UefiPayloadPkg/Tools/ElfFv.py b/UefiPayloadPkg/Tools/ElfFv.py = index a3d5bf08b9..3f0f9272a7 100644 --- a/UefiPayloadPkg/Tools/ElfFv.py +++ b/UefiPayloadPkg/Tools/ElfFv.py @@ -267,7 +267,7 @@ def AddSectionHeader64(SHentry, NewUPLEntrylen, Section= HeaderEntrySize, Index, R # if RemoveNameOffset !=3D 0 that is remove function. if (= RemoveNameOffset !=3D 0): if (unpacked_header.sh_name > RemoveN= ameOffset):- unpacked_header.sh_name -=3D RemoveNameOffset+ = unpacked_header.sh_name -=3D len (SectionName) #= Modify size of name string section entry in section entry. if = (Index =3D=3D StringIndexNumber): unpacked_header.sh_size -= =3D len (SectionName)@@ -298,7 +298,7 @@ def AddSectionHeader32(SHentry, Ne= wUPLEntrylen, SectionHeaderEntrySize, Index, R # if RemoveNameOffset !=3D 0 that is remove function. if (= RemoveNameOffset !=3D 0): if (unpacked_header.sh_name > RemoveN= ameOffset):- unpacked_header.sh_name -=3D RemoveNameOffset+ = unpacked_header.sh_name -=3D len (SectionName) #= Modify size of name string section entry in section entry. if = (Index =3D=3D StringIndexNumber): unpacked_header.sh_size -= =3D len (SectionName)@@ -710,7 +710,7 @@ def AddSection32(UniversalPayloadE= ntry, AddSectionName, ElfHeaderOffset, Section ElfHeaderSize =3D 52 ElfHandPH =3D ElfHeaderSize + (elf_he= ader.e_phnum * elf_header.e_phentsize) NewUPLEntry =3D UPLEntry[:El= fHandPH]- # Keep Section header and program header table, AddSection= 64() only recombined section and section header.+ # Keep Section hea= der and program header table, AddSection32() only recombined section and se= ction header. NewUPLEntry =3D bytearray(NewUPLEntry) # Sect= ions is recombined. # 1. name of added section is added in name str= ing section.--=20 2.39.1.windows.1