From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id D80827803DF for ; Thu, 18 Apr 2024 14:21:18 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=OuDeQ1hDeKFRgJF4CUinyd1lgYwGvaNwSBhyZTdxrrc=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1713450077; v=1; b=tknXFasHursnGLk7iprXvchZTdy/oaVuuiLyZCWI1GwSLv4pXSCJ3Jbh+iBYmuZnUKw2zfl3 KhACGGO6aBBStdflfNVYp07N+kidOxWi7aRd8d0ksNYX06ZajPcPqoSrWoJmtktj/DXIimgonO7 6yysRgr/JyWdP2XrZjyOqrFyIoETtWJq0GCHEQRtTsmIwZQrKttRNe/cXVJ5+vm34hrqpbXmo2J jNEcJyqhaOHKNoEb7icylIsE+cC/Py+9g6BZldh9M3PI5uZqvihyAmHTJ19cZlPRqJSMfX41hze AUJq5+Y4RqlH1HYntIERHA3xm8cOx5ktLfX4whn45+exQ== X-Received: by 127.0.0.2 with SMTP id TyrIYY7687511xUDpgTGxDX1; Thu, 18 Apr 2024 07:21:17 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.14337.1713450076396424918 for ; Thu, 18 Apr 2024 07:21:16 -0700 X-Received: from [10.137.194.171] (unknown [131.107.159.43]) by linux.microsoft.com (Postfix) with ESMTPSA id 0019620FD89E; Thu, 18 Apr 2024 07:21:15 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0019620FD89E Message-ID: <6a542022-335d-4de3-95c6-6f04c9bbb370@linux.microsoft.com> Date: Thu, 18 Apr 2024 07:21:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] MdeModulePkg: Fix MAT SplitRecord() Logic introduce one bug and will cause SUT reset when boot to windows To: devel@edk2.groups.io, yanbo.huang@intel.com, Ard Biesheuvel , "Bi, Dandan" Cc: Taylor Beebe , "Wang, Jian J" , "Gao, Liming" , "Zhou, Jianfeng" References: <20231127181818.411-1-taylor.d.beebe@gmail.com> <20231127181818.411-11-taylor.d.beebe@gmail.com> <45b9b2a8-4bbb-4d67-94a9-6c6d6607feb7@gmail.com> <045edd40-88e7-4af2-ab15-61aa8701f9a4@gmail.com> <140baa4f-b082-4121-bc34-7c03002d8de6@gmail.com> From: "Oliver Smith-Denny" In-Reply-To: Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 18 Apr 2024 07:21:16 -0700 Resent-From: osde@linux.microsoft.com Reply-To: devel@edk2.groups.io,osde@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: HhhycBDwwZfKQuvaBXrn08pFx7686176AA= Content-Language: en-CA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=tknXFasH; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io On 4/18/2024 6:56 AM, Huang, Yanbo wrote: > The PCD PcdPlatformEfiRtCodeMemorySize is used in https://github.com/tian= ocore/edk2-platforms/blob/master/Platform/Intel/MinPlatformPkg/PlatformInit= /PlatformInitPei/PlatformInitPreMem.c > This PCD seems defined the size allocated for run time services code, and= the similar PCD is PcdPlatformEfiRtDataMemorySize, seems defined the size = allocated for run time services data. > I guess dandan means if the runtime services code size is small than the = PCD defined, then the " Extra EfiRuntimeServicesCode regions which aren't p= art of loaded runtime images." size should be FixedPcdGet32 (PcdPlatformEfi= RtCodeMemorySize) - the actual runtime image code size? >=20 Drawing the lines here, we will lie in the EFI_MEMORY_MAP to say that all bin memory is allocated, regardless of this PCD: https://github.com/tianocore/edk2/blob/0afb8743493853e30171f6000de51242e22a= 1eb8/MdeModulePkg/Core/Dxe/Mem/Page.c#L1973-L1989 So this is just junk unallocated memory that we are reporting as a type it *could* be if an allocation occurs to minimize failures of ExitBootServices. Which is questionable. But in terms of attributes, I would expect we either have this unallocated memory marked the same as the bin type or better, mark it RP if we can (Taylor is making a change to set RP on free memory by default, so we would have this in the page table, but we would need to decide what we tell the OS). Going back to the questionableness of this: can we not report the entire bin as allocated memory to the OS? I understand what the comment is saying; I don't like that we will lie to the OS and reserve larger chunks of runtime memory than we actually need and that will get the wrong permissions set on it (for example making this garbage data be executable). Thanks, Oliver -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117994): https://edk2.groups.io/g/devel/message/117994 Mute This Topic: https://groups.io/mt/105477564/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-