Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-01 Thread Ard Biesheuvel
Hi Oliver, On Tue, 27 Feb 2024 at 21:27, Oliver Smith-Denny wrote: > > When an ImageRecord is stored by ImagePropertiesRecordLib, it reports the > CodeSegmentSize as the SizeOfRawData from the image. However, the image > as loaded into memory is aligned to the SectionAlignment, so > SizeOfRawData

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-04 Thread Oliver Smith-Denny
Hi Ard, On 3/1/2024 3:58 AM, Ard Biesheuvel wrote: Hi Oliver, On Tue, 27 Feb 2024 at 21:27, Oliver Smith-Denny wrote: When an ImageRecord is stored by ImagePropertiesRecordLib, it reports the CodeSegmentSize as the SizeOfRawData from the image. However, the image as loaded into memory is ali

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-04 Thread Ard Biesheuvel
On Mon, 4 Mar 2024 at 18:49, Oliver Smith-Denny wrote: > > Hi Ard, > > On 3/1/2024 3:58 AM, Ard Biesheuvel wrote: > > Hi Oliver, > > > > On Tue, 27 Feb 2024 at 21:27, Oliver Smith-Denny > > wrote: > >> > >> When an ImageRecord is stored by ImagePropertiesRecordLib, it reports the > >> CodeSegment

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-04 Thread Oliver Smith-Denny
On 3/4/2024 10:54 AM, Ard Biesheuvel wrote: On Mon, 4 Mar 2024 at 18:49, Oliver Smith-Denny wrote: Hi Ard, On 3/1/2024 3:58 AM, Ard Biesheuvel wrote: Hi Oliver, On Tue, 27 Feb 2024 at 21:27, Oliver Smith-Denny wrote: When an ImageRecord is stored by ImagePropertiesRecordLib, it reports t

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-04 Thread Oliver Smith-Denny
On 3/4/2024 11:24 AM, Oliver Smith-Denny wrote: On 3/4/2024 10:54 AM, Ard Biesheuvel wrote: On Mon, 4 Mar 2024 at 18:49, Oliver Smith-Denny wrote: Hi Ard, On 3/1/2024 3:58 AM, Ard Biesheuvel wrote: Hi Oliver, On Tue, 27 Feb 2024 at 21:27, Oliver Smith-Denny wrote: -  ImageRecordCode

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-11 Thread Oliver Smith-Denny
On 3/4/2024 2:38 PM, Oliver Smith-Denny wrote: On 3/4/2024 11:24 AM, Oliver Smith-Denny wrote: On 3/4/2024 10:54 AM, Ard Biesheuvel wrote: On Mon, 4 Mar 2024 at 18:49, Oliver Smith-Denny wrote: Hi Ard, On 3/1/2024 3:58 AM, Ard Biesheuvel wrote: Hi Oliver, On Tue, 27 Feb 2024 at 21:27, Oli

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-12 Thread Ard Biesheuvel
On Mon, 11 Mar 2024 at 20:34, Oliver Smith-Denny wrote: > > On 3/4/2024 2:38 PM, Oliver Smith-Denny wrote: > > On 3/4/2024 11:24 AM, Oliver Smith-Denny wrote: > >> On 3/4/2024 10:54 AM, Ard Biesheuvel wrote: > >>> On Mon, 4 Mar 2024 at 18:49, Oliver Smith-Denny > >>> wrote: > > Hi Ard,

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-12 Thread Oliver Smith-Denny
On 3/12/2024 1:32 AM, Ard Biesheuvel wrote: On Mon, 11 Mar 2024 at 20:34, Oliver Smith-Denny wrote: On 3/4/2024 2:38 PM, Oliver Smith-Denny wrote: On 3/4/2024 11:24 AM, Oliver Smith-Denny wrote: On 3/4/2024 10:54 AM, Ard Biesheuvel wrote: On Mon, 4 Mar 2024 at 18:49, Oliver Smith-Denny wro

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-14 Thread Marvin Häuser
Good day everyone, Sorry for interjecting, but I’d like to avoid premature changes to PE code that would only make the current mess even worse. > On 4. Mar 2024, at 20:24, Oliver Smith-Denny wrote: > > I relooked at the spec, you are correct, SizeOfRawData is aligned to > the FileAlignment. So

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-14 Thread Oliver Smith-Denny
Hi Marvin, Thanks for looking at this. Since sending out the v1, I have done a lot more digging into our PE loader, others, the spec, and differences between MSVC and our ElfConvert tool. I agree that my understanding was flawed in my original comments. On 3/14/2024 2:57 AM, Marvin Häuser wrote:

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-14 Thread Marvin Häuser
> On 14. Mar 2024, at 15:45, Oliver Smith-Denny > wrote: > > This does not appear to be the case with MSVC built binaries. I am > seeing that VirtualSize is the size of the data-initialized part of the > section. What? :( So you are saying modern MSVC generates PEs that either have non-contig

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-15 Thread Oliver Smith-Denny
On 3/14/2024 2:57 PM, Marvin Häuser wrote: On 14. Mar 2024, at 15:45, Oliver Smith-Denny wrote: This does not appear to be the case with MSVC built binaries. I am seeing that VirtualSize is the size of the data-initialized part of the section. What? :( So you are saying modern MSVC generat

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-15 Thread Marvin Häuser
> On 15. Mar 2024, at 23:57, Oliver Smith-Denny > wrote: > > I don't think this is what I'm saying. What I am trying to say is that > on MSVC, I see PE images getting created that have VirtualSize set to > the actual number of initialized bytes in that section (not padded to > the section align

Re: [edk2-devel][PATCH v1 1/3] MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSize

2024-03-16 Thread Oliver Smith-Denny
On 3/15/2024 4:45 PM, Marvin Häuser wrote: On 15. Mar 2024, at 23:57, Oliver Smith-Denny wrote: I don't think this is what I'm saying. What I am trying to say is that on MSVC, I see PE images getting created that have VirtualSize set to the actual number of initialized bytes in that section (