* [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader
@ 2023-06-14 14:00 brucex.wang
2023-06-14 14:07 ` Wang, BruceX
0 siblings, 1 reply; 3+ messages in thread
From: brucex.wang @ 2023-06-14 14:00 UTC (permalink / raw)
To: devel; +Cc: BruceX Wang, Guo Dong, Ray Ni, Sean Rhodes, James Lu
From: BruceX Wang <brucex.wang@intel.com>
Fix incorrect code on AddSectionHeader32() and AddSectionHeader64()
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Signed-off-by: BruceX Wang <brucex.wang@intel.com>
---
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, SectionHeaderEntrySize, Index, R
# if RemoveNameOffset != 0 that is remove function.
if (RemoveNameOffset != 0):
if (unpacked_header.sh_name > RemoveNameOffset):
- unpacked_header.sh_name -= RemoveNameOffset
+ unpacked_header.sh_name -= len (SectionName)
# Modify size of name string section entry in section entry.
if (Index == StringIndexNumber):
unpacked_header.sh_size -= len (SectionName)
@@ -298,7 +298,7 @@ def AddSectionHeader32(SHentry, NewUPLEntrylen, SectionHeaderEntrySize, Index, R
# if RemoveNameOffset != 0 that is remove function.
if (RemoveNameOffset != 0):
if (unpacked_header.sh_name > RemoveNameOffset):
- unpacked_header.sh_name -= RemoveNameOffset
+ unpacked_header.sh_name -= len (SectionName)
# Modify size of name string section entry in section entry.
if (Index == StringIndexNumber):
unpacked_header.sh_size -= len (SectionName)
@@ -710,7 +710,7 @@ def AddSection32(UniversalPayloadEntry, AddSectionName, ElfHeaderOffset, Section
ElfHeaderSize = 52
ElfHandPH = ElfHeaderSize + (elf_header.e_phnum * elf_header.e_phentsize)
NewUPLEntry = UPLEntry[:ElfHandPH]
- # Keep Section header and program header table, AddSection64() only recombined section and section header.
+ # Keep Section header and program header table, AddSection32() only recombined section and section header.
NewUPLEntry = bytearray(NewUPLEntry)
# Sections is recombined.
# 1. name of added section is added in name string section.
--
2.39.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader
2023-06-14 14:00 [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader brucex.wang
@ 2023-06-14 14:07 ` Wang, BruceX
2023-06-14 14:08 ` Guo, Gua
0 siblings, 1 reply; 3+ messages in thread
From: Wang, BruceX @ 2023-06-14 14:07 UTC (permalink / raw)
To: devel@edk2.groups.io
Cc: Dong, Guo, Ni, Ray, Rhodes, Sean, Lu, James, Guo, Gua
-----Original Message-----
From: Wang, BruceX <brucex.wang@intel.com>
Sent: Wednesday, June 14, 2023 10:00 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX <brucex.wang@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>
Subject: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader
From: BruceX Wang <brucex.wang@intel.com>
Fix incorrect code on AddSectionHeader32() and AddSectionHeader64()
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Signed-off-by: BruceX Wang <brucex.wang@intel.com>
---
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, SectionHeaderEntrySize, Index, R
# if RemoveNameOffset != 0 that is remove function. if (RemoveNameOffset != 0): if (unpacked_header.sh_name > RemoveNameOffset):- unpacked_header.sh_name -= RemoveNameOffset+ unpacked_header.sh_name -= len (SectionName) # Modify size of name string section entry in section entry. if (Index == StringIndexNumber): unpacked_header.sh_size -= len (SectionName)@@ -298,7 +298,7 @@ def AddSectionHeader32(SHentry, NewUPLEntrylen, SectionHeaderEntrySize, Index, R
# if RemoveNameOffset != 0 that is remove function. if (RemoveNameOffset != 0): if (unpacked_header.sh_name > RemoveNameOffset):- unpacked_header.sh_name -= RemoveNameOffset+ unpacked_header.sh_name -= len (SectionName) # Modify size of name string section entry in section entry. if (Index == StringIndexNumber): unpacked_header.sh_size -= len (SectionName)@@ -710,7 +710,7 @@ def AddSection32(UniversalPayloadEntry, AddSectionName, ElfHeaderOffset, Section
ElfHeaderSize = 52 ElfHandPH = ElfHeaderSize + (elf_header.e_phnum * elf_header.e_phentsize) NewUPLEntry = UPLEntry[:ElfHandPH]- # Keep Section header and program header table, AddSection64() only recombined section and section header.+ # Keep Section header and program header table, AddSection32() only recombined section and section header. NewUPLEntry = bytearray(NewUPLEntry) # Sections is recombined. # 1. name of added section is added in name string section.--
2.39.1.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader
2023-06-14 14:07 ` Wang, BruceX
@ 2023-06-14 14:08 ` Guo, Gua
0 siblings, 0 replies; 3+ messages in thread
From: Guo, Gua @ 2023-06-14 14:08 UTC (permalink / raw)
To: Wang, BruceX, devel@edk2.groups.io
Cc: Dong, Guo, Ni, Ray, Rhodes, Sean, Lu, James
Reviewed-by: Gua Guo <gua.guo@intel.com>
-----Original Message-----
From: Wang, BruceX <brucex.wang@intel.com>
Sent: Wednesday, June 14, 2023 10:00 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX <brucex.wang@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>
Subject: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader
From: BruceX Wang <brucex.wang@intel.com>
Fix incorrect code on AddSectionHeader32() and AddSectionHeader64()
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Signed-off-by: BruceX Wang <brucex.wang@intel.com>
---
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, SectionHeaderEntrySize, Index, R
# if RemoveNameOffset != 0 that is remove function. if (RemoveNameOffset != 0): if (unpacked_header.sh_name > RemoveNameOffset):- unpacked_header.sh_name -= RemoveNameOffset+ unpacked_header.sh_name -= len (SectionName) # Modify size of name string section entry in section entry. if (Index == StringIndexNumber): unpacked_header.sh_size -= len (SectionName)@@ -298,7 +298,7 @@ def AddSectionHeader32(SHentry, NewUPLEntrylen, SectionHeaderEntrySize, Index, R
# if RemoveNameOffset != 0 that is remove function. if (RemoveNameOffset != 0): if (unpacked_header.sh_name > RemoveNameOffset):- unpacked_header.sh_name -= RemoveNameOffset+ unpacked_header.sh_name -= len (SectionName) # Modify size of name string section entry in section entry. if (Index == StringIndexNumber): unpacked_header.sh_size -= len (SectionName)@@ -710,7 +710,7 @@ def AddSection32(UniversalPayloadEntry, AddSectionName, ElfHeaderOffset, Section
ElfHeaderSize = 52 ElfHandPH = ElfHeaderSize + (elf_header.e_phnum * elf_header.e_phentsize) NewUPLEntry = UPLEntry[:ElfHandPH]- # Keep Section header and program header table, AddSection64() only recombined section and section header.+ # Keep Section header and program header table, AddSection32() only recombined section and section header. NewUPLEntry = bytearray(NewUPLEntry) # Sections is recombined. # 1. name of added section is added in name string section.--
2.39.1.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-14 14:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14 14:00 [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader brucex.wang
2023-06-14 14:07 ` Wang, BruceX
2023-06-14 14:08 ` Guo, Gua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox