From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web08.8136.1624362953294510794 for ; Tue, 22 Jun 2021 04:55:54 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@posteo.de header.s=2017 header.b=EH4bXSPB; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 77B2C24002C for ; Tue, 22 Jun 2021 13:55:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1624362950; bh=q9ZfxdpKceVLNbR8Ciga4mRSrxlYdHKOTNMucqVxnh0=; h=Subject:To:From:Date:From; b=EH4bXSPBQEpAmhwXCCKEASp+4ZVXdo/+qLE77t8cHSFaOS6RdgviZoYPyIQb34hXn cL1Q7a9HI2ir3W+x6vpoV1fpS+1EK2Yw46Fqi/jyvbySIM8pGmuiViK6Hsl80BLO5b jd0HmtsZ57bORZdlNmb3aZXHDDbOg2a7+TxKBJHCjdIi5EqU1sEoK+OKI4WDDobeI+ sQrvrh2qk6R4n4mAqRtlrCujX+rb6pzs3IoxwCRBp0YZvhlWrC0rjudk1qVUNZFJgG Juttj9+Gu3QPMGKmmh7GmYq0KZXxa0JrkgT6aJknjYZYG9I6p7zvTtkeg0Ss5FNNlI UGvs4bJnFSiyA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4G8Px06M6pz6tm9; Tue, 22 Jun 2021 13:55:48 +0200 (CEST) Subject: Re: [edk2-devel] Possibly incorrect size in memory profile structure To: "Zeng, Star" , "devel@edk2.groups.io" , "Yao, Jiewen" References: <919c6908-40a4-7c19-c4cc-ced6d172cee4@posteo.de> From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Message-ID: Date: Tue, 22 Jun 2021 11:55:48 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: quoted-printable Ahhh, I see it. The size does to describe the data structure that is=20 existent at that point in time, but the one that is created by=20 MemoryProfileCopyData() later, and the alignment is applied because it=20 ends up as a flat structure array. Makes sense, thank you a lot! Best regards, Marvin On 22.06.21 12:20, Zeng, Star wrote: > Not sure I can understand your question correctly. But try best to recal= l and comment since not on it for long time. =F0=9F=98=8A > > [2], [3] and [4] are all for interior storage management by MEMORY_PROFI= LE_DRIVER_INFO_DATA, MEMORY_PROFILE_DRIVER_INFO_DATA.PdbString points to th= e PDB string. > > Exterior storage are managed by ProfileProtocolGetData() and MemoryProfi= leCopyData() from interior storage, 8B alignment are for exterior storage, = PDB string is at the end of MEMORY_PROFILE_DRIVER_INFO structure. > > > Thanks, > Star > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Marvin H= =C3=A4user > Sent: 2021=E5=B9=B46=E6=9C=8819=E6=97=A5 18:56 > To: Zeng, Star ; Yao, Jiewen = ; devel@edk2.groups.io > Subject: [edk2-devel] Possibly incorrect size in memory profile structur= e > > Good day, > > I have a question regarding a part of the memory profiling code. Namely = this piece of code [1] introduced storing the PDB file name among the drive= r information. This is implement by a string pointer in the "MEMORY_PROFILE= _DRIVER_INFO_DATA" structure (which embeds the "MEMORY_PROFILE_DRIVER_INFO"= structure [2]). The length of the embedded "MEMORY_PROFILE_DRIVER_INFO" in= stance is set to the header size plus the 8B-aligned size of the PDB name [= 3], albeit its storage is not used for the PDB file name, and the storage t= hat is used instead is not aligned by 8B [4]. Ominously, the interior struc= ture does have a comment that indicates it is (or was) supposed to hold the= PDB file name at some point [5]. > > I do not see that concept being used, and instead see the previously des= cribed way of storage, so I believe the aligned size is a forgotten piece f= rom a refactoring. I imagine early on, the interior structure was supposed = to hold the PDB name, and the alignment was needed to satisfy the following= data's requirements. However, the change to the exterior storage should ma= ke this superfluous, and the specified size seems to be incorrect in all ca= ses. > > Can you please give this a quick look and help me determine whether this= is a bug? Thank you for your time! > > Best regards, > Marvin > > [1] > https://github.com/tianocore/edk2/commit/1d60fe96422206d37e1d74198bb11b2= cf6195157#diff-b42ade68f10fa42dfa25570f0f9a165db4b974877c98d8845e384a40252e= c220R407-R428 > > [2] > https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe5668= 8210141/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c#L25 > > [3] > https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe5668= 8210141/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c#L417 > > [4] > https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe5668= 8210141/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c#L404 > > [5] > https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe5668= 8210141/MdeModulePkg/Include/Guid/MemoryProfile.h#L59 > > >=20 > >