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.web10.13031.1686751686738246770 for ; Wed, 14 Jun 2023 07:08:06 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=f++Rq9XH; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: gua.guo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686751686; x=1718287686; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=I69wTwZcM4uCjYKVS13PyThvRjtI+fcPnw2fz59++mA=; b=f++Rq9XHooWgq4KciyPw5ExGOOgTTDjaDeI1/4hkWyWpqId4TjSsYBHU 5FHo8bphGMOPmYl6HRT8BauI4p3IJxxseg5vpxoKrHRNt/Hj9fenlfck3 8sYb5gx9c1lFNb/jWaVJRNJLSOJ1V3Vo1RRkouFwtKGj1AZ4yqLfNfc8H BUzSTNHAI90pR9FwNQfxZpbDxe1ZP7shDOzjBxV0hEwjfx4WKc8+XUI37 n1kGuSZAh0OGqXV1nsHWa7FfmVFcyqZj4YSYavViPgjRfB89niE6RsyTH pVl/AUFKuopIbzSHwhF8nTCh2VhXU0SriZxlWee6+0tzt3kWPMlG/Z0cA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="348280179" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="348280179" 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:08:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="745091472" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="745091472" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga001.jf.intel.com with ESMTP; 14 Jun 2023 07:08:05 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.2507.23; Wed, 14 Jun 2023 07:08:05 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX610.amr.corp.intel.com (10.22.229.23) 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:08:04 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx612.amr.corp.intel.com (10.22.229.25) 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:08:04 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.168) 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.2507.23; Wed, 14 Jun 2023 07:08:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZKDOiVBZg8Ge0G9+0VsAGc/jRk458onMqOlVUHWOyqlGeR1e2G3DMGJZ7Z+amZhTaE/clnxpdOPlDkz7uYZsP8ktruCKfWbE5yv3cqIuFZcFBJdGeNGxIx+OPBqwYu4t0hoHQ+Ak18e1Pi3V+TVZ+fS/RoSVzt65WvEp7YeUA52h5pc+UMtblTSggK7+FaWw9qq/6hMkkOF3MBZmp3coHcdY2EhS5Ph3O8yxkw2zF6H3a5+BoODE1+AksviRw4oTM8lVhQJzCKud8w8yjsdu02FkrB13SMQ8Qi8ugobY8lEsBjn+QPzezXqpJ/6m8YqfM6i9rdcyGZmVAjhuTIZoGQ== 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=4gsHfgutYfDxXLEVvzJ6BEtBQg82fM+2bE28tIKwIWE=; b=WsDFOy4aQyeCmm5ID7A9kwSaT/zi1IJxL4mloBm6CyweUrL6uyxwU0ad37Dj4rHQu6mRLXohPKnYTz9rfHBire/mK32CaomsMfeLAimXtCCKhjkymKoJlQHMKE1V6U6j8nxuClTorca3OSlLAav0xWoBbZeS992FEHrIAAkKTqyWseqA3/sz04jogGR30Luv8lwu/t1VfxYjcH8t9YZUPrKAYJV7lXeMIH7Cci0aRcibY8EIZ0KlgqvtWFUR+GrCAr8kt5nqfoo+6cyIPFjYleguYqj5b6HCPvRGUfFjWJ2aGuO9+h3jKgugLBXMheihd7ye5paKjamd9o5j+cwT1w== 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 BL1PR11MB5478.namprd11.prod.outlook.com (2603:10b6:208:31d::12) by SA3PR11MB7556.namprd11.prod.outlook.com (2603:10b6:806:31f::21) 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:08:01 +0000 Received: from BL1PR11MB5478.namprd11.prod.outlook.com ([fe80::fef:fccb:3839:4f36]) by BL1PR11MB5478.namprd11.prod.outlook.com ([fe80::fef:fccb:3839:4f36%5]) with mapi id 15.20.6477.037; Wed, 14 Jun 2023 14:08:01 +0000 From: "Guo, Gua" To: "Wang, BruceX" , "devel@edk2.groups.io" CC: "Dong, Guo" , "Ni, Ray" , "Rhodes, Sean" , "Lu, James" Subject: Re: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader Thread-Topic: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader Thread-Index: AQHZnsif9PAXO9O8vUmbaUgQvlhOhK+KVShggAAAY2A= Date: Wed, 14 Jun 2023 14:08:01 +0000 Message-ID: References: <9d76dda748aba4b4614d99227d225c87157c5f84.1686750331.git.brucex.wang@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-traffictypediagnostic: BL1PR11MB5478:EE_|SA3PR11MB7556:EE_ x-ms-office365-filtering-correlation-id: 3869b17a-9ec2-4149-6a8a-08db6ce0c3ed 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: lTM7GikK7eRk/0KTuH0waPNdkMPMMQjfb+pTzQUyicr4k0AkM6ii0bTw9pNCurBI82hTUEYw+RhBQhLvM2W+ed11MjFsPGq6i3urta9w995mDV8tlFgljKuWxNj+2t9kIua7yhqA607TBYBJ64CHyRohZFVtfzSaHxUXgUjS8VlLAV7bpNNHU/Vky1u0zEmoz/yRZbw37B4hrVJZ4aW0GRFjEeJXwHtDRgBkUlf5MT6piHE+tq9gFnXnS5pRKxopl62JGOYJ3r+nVePiqoArjVlCo/ju+qCvtAfddFRxu1YiAYWd+fAQeAAXvVUq26N1uIm3nGGJspB3BRUez9gyMfcURdbcGFKunczGh8O9qvc94CHiWZ0aJLsh/OWtdbYqJ6gfHhcVV8RJQGyeyXgVEdf/SbH7vIAvoV9NKHvthtvfHi1bmwxP/m//XALUSM0gOPw+vcEmMdtsbcBm9nmz6ed2l/GmoD6qvCkBQs+k4MTo+KA6ODFS+dvHTMEJ6Wxs301gfN3hycsE4FS80eLjbEUqmMheuXgaOIXCZLEfYX5ohZtn+noqBi7962z30DspK5vUdjvqe5AZsGpi5/Fsi8O26ctCGfKGZe6wmFbybJV9z2QG/XLYjlrtOOZ9j3fM x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR11MB5478.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(376002)(346002)(366004)(396003)(451199021)(107886003)(7696005)(83380400001)(38100700002)(6506007)(86362001)(82960400001)(38070700005)(122000001)(53546011)(9686003)(33656002)(26005)(55016003)(186003)(2906002)(54906003)(110136005)(316002)(4326008)(66446008)(66556008)(66476007)(76116006)(64756008)(41300700001)(5660300002)(71200400001)(52536014)(478600001)(8936002)(66946007)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+nltpbyszVi3aoxKxVZzyWiJDI4AX19e5gWqlR3rUdswL62aIG/n+GvbV5LG?= =?us-ascii?Q?CmysH7zqFUWVYEoEr0SEx9xO9bvKy86Okx8YhO4FFS2BbQaqUR5s8WmtfSY/?= =?us-ascii?Q?IGiSpOPySyFvCQiHdLQhwYjKmNsDG39inOAxSH1cfDp6x9e9lQWUaTPejY86?= =?us-ascii?Q?kw4w4bSG+KiD7b+DAzeqjH5wg1SK29e3uEWFOq58v5xDgxUD7v92/mBWs3kl?= =?us-ascii?Q?SOxDpSEhhXs6728yisWG3+gygzAECJD5QqmNAfL3PJEpHGdJiuzE5s1xeLOU?= =?us-ascii?Q?xrqzVhx0pzUlTTT5sijbStUfSglvLSU7BVpR98djMAG39UNBb5s6yvCnLh2I?= =?us-ascii?Q?MkP/KzS/tdXdkFsWu5ZyPXDCUw7uh9mLXWbFiZYvOM7H+wsiOu3adM4oiFut?= =?us-ascii?Q?tucJN5qjCdd3+MxPffLS3gj4+E6NlK0vW/KdyCXSXsxpZzmERYHEMtAjMcmb?= =?us-ascii?Q?rX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+5mTP+soKkdkBt?= =?us-ascii?Q?fI11P7bBm307GU8qPeWGnw2hCo1Huv+yjLzrOhTAfNdR1M8UoaC4b/5RJnws?= =?us-ascii?Q?mMpN6z7lp0OKbRWI5qkd8WSAmWsmEvROADUG5/f7FBZ5s5YUyBBSNTI+b1xY?= =?us-ascii?Q?yyx6T3/yDs/+C/iSREqqZyt0nbZos4D3Aaa7FDb74YRhUa1SETaf3jfDNjVJ?= =?us-ascii?Q?HmTwiYmv3ZcKKCEZ6lU=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL1PR11MB5478.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3869b17a-9ec2-4149-6a8a-08db6ce0c3ed X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jun 2023 14:08:01.8117 (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: xEu0hklieQprbhI/TqdDK1p2Mk0PbvLCijmL9ZxKkktkPCQgRgyLvGbNRifcj1Nw3ar9voExyJreUntyviBwxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR11MB7556 Return-Path: gua.guo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Gua Guo -----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