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.web11.20060.1624100180868901005 for ; Sat, 19 Jun 2021 03:56:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=K6h0eYHv; 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 B2717240027 for ; Sat, 19 Jun 2021 12:56:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1624100177; bh=1FiQfLDUsSe8gkBAxYq91sTrmD+RDj2WfF04jbimXxM=; h=To:From:Subject:Date:From; b=K6h0eYHvDVyT8LlIE8D08KHGv86X7v/VhJ5cO1Cm4W2OpwpTmZ/kFmfb/W8PfLzqk JPeLTuvbfK6AWvyB1wJvTJcWD21RMFxJWtNt+0OrNJmgYJhaaizTsuItkpZ0CvhdfB 8ZM21DI/KV4BqbtTytRmCbS7Lpv4pIFw4WfMPDeyFVXJOxHH7TD81egbeFn2hOFPA/ eN7rZT45DVya4q2ktADydQC9EmCvHvf3tvjRun8FPLUQS4x9vL+Z9+RHrR8rmjYYq2 c1WYl//8qJFGKlml1YZsiXtwHCiXJFBCIefTo7wLx3xuU/0DXZ82Mg7/aNRGgL52K7 gme+c9RnCTJTA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4G6Xlh5Xvmz9rxG; Sat, 19 Jun 2021 12:56:16 +0200 (CEST) To: star.zeng@intel.com, jiewen.yao@intel.com, "devel@edk2.groups.io" From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Subject: Possibly incorrect size in memory profile structure Message-ID: <919c6908-40a4-7c19-c4cc-ced6d172cee4@posteo.de> Date: Sat, 19 Jun 2021 10:56:16 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB 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