public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marvin Häuser" <mhaeuser@posteo.de>
To: star.zeng@intel.com, jiewen.yao@intel.com,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: Possibly incorrect size in memory profile structure
Date: Sat, 19 Jun 2021 10:56:16 +0000	[thread overview]
Message-ID: <919c6908-40a4-7c19-c4cc-ced6d172cee4@posteo.de> (raw)

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 
driver 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" instance 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 that is used instead is not aligned 
by 8B [4]. Ominously, the interior structure 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 
described way of storage, so I believe the aligned size is a forgotten 
piece from 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 make this superfluous, and the specified size seems to be 
incorrect in all cases.

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/1d60fe96422206d37e1d74198bb11b2cf6195157#diff-b42ade68f10fa42dfa25570f0f9a165db4b974877c98d8845e384a40252ec220R407-R428

[2] 
https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe56688210141/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c#L25

[3] 
https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe56688210141/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c#L417

[4] 
https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe56688210141/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c#L404

[5] 
https://github.com/tianocore/edk2/blob/a63914d3f603580e5aeceb5edbafe56688210141/MdeModulePkg/Include/Guid/MemoryProfile.h#L59

             reply	other threads:[~2021-06-19 10:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19 10:56 Marvin Häuser [this message]
2021-06-22 10:20 ` [edk2-devel] Possibly incorrect size in memory profile structure Zeng, Star
2021-06-22 11:55   ` Marvin Häuser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=919c6908-40a4-7c19-c4cc-ced6d172cee4@posteo.de \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox