public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dandan Bi" <dandan.bi@intel.com>
To: Taylor Beebe <taylor.d.beebe@gmail.com>,
	"Huang, Yanbo" <yanbo.huang@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
	"Gao, Liming" <gaoliming@byosoft.com.cn>,
	"Zhou, Jianfeng" <jianfeng.zhou@intel.com>,
	"Bi, Dandan" <dandan.bi@intel.com>
Subject: Re: [edk2-devel] MdeModulePkg: Fix MAT SplitRecord() Logic introduce one bug and will cause SUT reset when boot to windows
Date: Thu, 18 Apr 2024 13:02:40 +0000	[thread overview]
Message-ID: <MN6PR11MB8242CF11BAB3308390FA10ABEA0E2@MN6PR11MB8242.namprd11.prod.outlook.com> (raw)
In-Reply-To: <140baa4f-b082-4121-bc34-7c03002d8de6@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3336 bytes --]

Hi Taylor,

>>Extra EfiRuntimeServicesCode regions which aren't part of loaded runtime images.
This may be related to the original size of EfiRuntimeServicesCode in memory map, and the size can be configured via PcdPlatformEfiRtCodeMemorySize.

If the size is large enough to hold all the runtime images and still has some remaining regions, then these regions are with EfiRuntimeServicesCode type and aren't part of loaded runtime images, right?
Pre-change https://github.com/tianocore/edk2/commit/e2f2bbe208b4c7ebcedacfc8333df1e52cbf07eb, such EfiRuntimeServicesCode regions are set with EFI_MEMORY_XP attribute.
Post-change https://github.com/tianocore/edk2/commit/e2f2bbe208b4c7ebcedacfc8333df1e52cbf07eb,  these regions don’t have any access attribute.
And now this patch [PATCH v1] MdeModulePkg: Fixup MAT Attributes After Splitting EFI Memory Map (groups.io)<https://edk2.groups.io/g/devel/message/117889> set these regions with EFI_MEMORY_RO.
I am not sure which attribute should be set for these regions.  And old codes with EFI_MEMORY_XP attribute for a long time and seems not cause any issue.


Thanks,
Dandan
From: Taylor Beebe <taylor.d.beebe@gmail.com>
Sent: Thursday, April 18, 2024 7:54 AM
To: Huang, Yanbo <yanbo.huang@intel.com>; devel@edk2.groups.io; Bi, Dandan <dandan.bi@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Zhou, Jianfeng <jianfeng.zhou@intel.com>
Subject: Re: [edk2-devel] MdeModulePkg: Fix MAT SplitRecord() Logic introduce one bug and will cause SUT reset when boot to windows


Hi Yanbo,
I didn't do it in the way you suggest for the same reason that the SplitTable() logic doesn't set attributes
on descriptors of type EfiRuntimeServicesData or other memory types. The purpose of the SplitTable() function
is to use the input image records to split descriptors so each image section has it's own descriptor. I think
it's reasonable to set the attributes on descriptors associated with images because those new descriptors are the
intended side effect of the function, but I don't think setting attributes on other descriptors is a good design pattern.
This pattern matches what's done in PiSmmCore/MemoryAttributesTable.c. Also, even if we did
it the way you suggest, we would still need call EnforceMemoryMapAttribute() later to set XP on the
EfiRuntimeServicesData descriptors.

Can you or Dandan explain the origin of the extra  EfiRuntimeServicesCode regions which aren't
part of loaded runtime images? It would be a good datapoint for our discussion on the proposed fix.

-Taylor
On 4/17/2024 7:04 AM, Huang, Yanbo wrote:
Hi Taylor,

Thanks for your update.
After test, issue can be fixed by your patch.
But why we not set the EFI_MEMORY_XP or EFI_MEMORY_RO attribute in SplitRecord API?
If we set the attribute in the beginning of the NewRecord created, it seems we don’t need to EnforceMemoryMapAttribute later?

Best Regards,
Yanbo Huang


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117989): https://edk2.groups.io/g/devel/message/117989
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]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 7399 bytes --]

  reply	other threads:[~2024-04-18 13:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 18:17 [edk2-devel] [PATCH v5 00/16] Add ImagePropertiesRecordLib and Fix MAT Bugs​ Taylor Beebe
2023-11-27 18:17 ` [edk2-devel] [PATCH v5 01/16] MdeModulePkg: Add ImagePropertiesRecordLib Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 02/16] ArmVirtPkg: Add ImagePropertiesRecordLib Instance Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 03/16] EmulatorPkg: " Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 04/16] OvmfPkg: " Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 05/16] UefiPayloadPkg: " Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 06/16] MdeModulePkg: Update MemoryAttributesTable.c to Reduce Global Variable Use Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 07/16] MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLib Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 08/16] MdeModulePkg: Add ImagePropertiesRecordLib Host-Based Unit Test Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 09/16] MdeModulePkg: Fix MAT Descriptor Count Calculation Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 10/16] MdeModulePkg: Fix MAT SplitRecord() Logic Taylor Beebe
2024-04-12  5:14   ` [edk2-devel] MdeModulePkg: Fix MAT SplitRecord() Logic introduce one bug and will cause SUT reset when boot to windows Huang, Yanbo
2024-04-12 15:09     ` Taylor Beebe
2024-04-14 14:35       ` Huang, Yanbo
2024-04-15 10:57         ` Dandan Bi
2024-04-16  1:17           ` Taylor Beebe
2024-04-17  2:32             ` Taylor Beebe
2024-04-17 14:04               ` Huang, Yanbo
2024-04-17 23:53                 ` Taylor Beebe
2024-04-18 13:02                   ` Dandan Bi [this message]
2024-04-18 13:17                     ` Ard Biesheuvel
2024-04-18 13:56                       ` Huang, Yanbo
2024-04-18 14:21                         ` Oliver Smith-Denny
2024-04-19  6:43                           ` Ni, Ray
2024-04-23 14:33                             ` Oliver Smith-Denny
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 11/16] MdeModulePkg: Fix MAT SplitTable() Logic Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 12/16] MdeModulePkg: Add NULL checks and Return Status to ImagePropertiesRecordLib Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 13/16] UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 14/16] MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLib Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 15/16] MdeModulePkg: Add Logic to Create/Delete Image Properties Records Taylor Beebe
2023-11-27 18:18 ` [edk2-devel] [PATCH v5 16/16] MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib Taylor Beebe
2023-11-27 18:40 ` [edk2-devel] [PATCH v5 00/16] Add ImagePropertiesRecordLib and Fix MAT Bugs​ Ard Biesheuvel
2023-11-28 10:22   ` Ni, Ray

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=MN6PR11MB8242CF11BAB3308390FA10ABEA0E2@MN6PR11MB8242.namprd11.prod.outlook.com \
    --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