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 38F65AC1AC5 for ; Fri, 5 Jul 2024 18:02:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=2DL7x8zFnPsOSrEqewIwECoJvdhcMRDb+GJIKj9hauc=; c=relaxed/simple; d=groups.io; h=From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID:Accept-Language:MIME-Version: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; s=20240206; t=1720202533; v=1; b=iHYalj7wEC18MH4BNwQfHWKXAfH99unAlWQpPipMUwzwkt/Gz8AlmJCdsE0x/jN/K/BLJ1WH gEacpZRVRglO9UcW8pJkw/MxzuQMYA4NSMeVpW3erYQzFtG0Ovsdq0sbMY4MyTbdNQifOzNvLSo Xxt86GKNVq5y2hCWNzCkxajZsUDER93Gzt4Hu12gGqW8qyD2jZ6Y5SWLkmeqwbJxfh/96h6miQL 5+ZCatHLSRLm7VOwKSZIaiaBRwHle1QDspciNDS1a2iLFa9tXrs4behZcttHIUVZbTOiT/fLfqU 1gUel+uxRjB8VMGNclgIHGaiV6IdxU92LlLlcsNjKsQTw== X-Received: by 127.0.0.2 with SMTP id Bs7vYY7687511xV94LqHbLIw; Fri, 05 Jul 2024 11:02:12 -0700 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.115]) by mx.groups.io with SMTP id smtpd.web10.6489.1720085214421133381 for ; Thu, 04 Jul 2024 02:26:55 -0700 X-Received: from PH7PR10MB6603.namprd10.prod.outlook.com (2603:10b6:510:207::21) by CH4PR10MB8099.namprd10.prod.outlook.com (2603:10b6:610:242::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.25; Thu, 4 Jul 2024 09:26:50 +0000 X-Received: from PH7PR10MB6603.namprd10.prod.outlook.com ([fe80::65d9:655a:be49:a4d2]) by PH7PR10MB6603.namprd10.prod.outlook.com ([fe80::65d9:655a:be49:a4d2%6]) with mapi id 15.20.7741.017; Thu, 4 Jul 2024 09:26:48 +0000 From: "David Hsieh via groups.io" To: "devel@edk2.groups.io" Subject: [edk2-devel] The NX bit in page table is not expected for new allocated EfiBootServicesCode Thread-Topic: The NX bit in page table is not expected for new allocated EfiBootServicesCode Thread-Index: AdrN9Dp0jQg+5yhOQhy45KN+9Tmdlw== Date: Thu, 4 Jul 2024 09:26:48 +0000 Message-ID: Accept-Language: zh-TW, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR10MB6603:EE_|CH4PR10MB8099:EE_ x-ms-office365-filtering-correlation-id: e3928ee4-f00b-4b6b-eb9b-08dc9c0b6dd6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?iso-2022-jp?B?T1JlRElFK0lWMmI4MG1qTGZVaFZqQXBVTXB0K0lQNVpxV0I3Y0JpK3pq?= =?iso-2022-jp?B?TkpwR1BkM3F0c3diNytteUl5aVNPLzZSdjVvVXoxR2pQTnFiRGV4TmJG?= =?iso-2022-jp?B?SXg4LzkrYmdLZTRXY0hNSVg5VUh3NHBYWUFLdTAybUZKbkczS0JHZWh2?= =?iso-2022-jp?B?TTlTTlhlcnA0Mi8zc2ZCZWp1Mi9CQkwrSlB1UEhqT09qM1pJOVhkWktL?= =?iso-2022-jp?B?QXpYdGs1K2U5Y1Z5OTMvN1NJWUJYdHQzV3J1a3JnaktWN0lkN3FQaGNr?= =?iso-2022-jp?B?TWxaZXR3T3hrKzYrNEdnNFg3RVI2VHhldmx6Q2JVbi9CaExvY0dwOTRZ?= =?iso-2022-jp?B?WnAzKzdvcVp3R25La0pPOU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jp?B?NTZCL3NPMGNuVlE2YTZnTnJnRHRMbUpSVFF6b0JsaUJMZHhZajhwMVhk?= =?iso-2022-jp?B?TmptUGVNVVc5SGdhdHFidVhBY2RmMm9aVDQyTEkrZm1wblhJeitQSWVG?= =?iso-2022-jp?B?SEI4bHAxblJydnRxUmlNdWFZTFR5eFNJU0dnTVp5WTROczRFRGRMVTJP?= =?iso-2022-jp?B?Njh4M01KVERqVjJkekZxTGI1WlFiTU0vTSs0NG9qRVpKZDBaUk5ONVpy?= =?iso-2022-jp?B?Ylpacm5zUVUyL3JEdVZROTdEeDR3QzNxK0dMYU5vL1Y1WVlqVzN0cVdR?= =?iso-2022-jp?B?Um44MEhzbWx2eC94SFRKZmFLdk00MmVlVm9LWDJ6blpDaWU3WHlMRzZE?= =?iso-2022-jp?B?N1FPTGhmVTNDdjVIRU9IRG13d0tXWkgxZ25LZENiRm1XeDhmemVzMUJU?= =?iso-2022-jp?B?KzBzWExJa0E0dlk0eFQwcTZvZHZKQUNmT3BweThURVlqc2gxT2wzcU1O?= =?iso-2022-jp?B?NHFOVTBQWGFJNzZwUmFJcFFzZjlTelArNy83dHlZaWJQV1hLTkZ1R3p3?= =?iso-2022-jp?B?SnFRZ0M2WTZxT01IeVZRZEpNZEVuYmFLWkYxQjQ1dEowcmFtUnlqVlBE?= =?iso-2022-jp?B?SGRvVkg5KzNLQi9yVzRhTHhEWlN4VUhYOUV0bzRYT2hGMEQ4US9yaG5Z?= =?iso-2022-jp?B?TkhWZzhDQ0ZxWGsrMExZVVRGRW5YcXBLc2ZqMVZ1K1BKdUtUN3VIV2Rm?= =?iso-2022-jp?B?OHNwY0luK0Y0eG1qVitRa2ZrZitxaVU2KzkrdDJHeGZQdmlNMDlkeUpC?= =?iso-2022-jp?B?Znc9PQ==?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?B?VVFaODJIMWN0b1k4aktScHp4R051SDlFY0xyRlJsdGtsVTQ5cT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XExY0thQ3Vtb1gxeXJCQkhNN0FEOFFHSzZ0UGpOMEZWRFNZ?= =?iso-2022-jp?B?T3ZKL2tpakdWYXJRMGFoU2RJcGJsekJPKzBiN1RIekFBUDNCY3NSZEhm?= =?iso-2022-jp?B?OWtMYXVVcms3SWhrbmx5eU51cVMrYUR0V3FRL3Z1eXlLaDlpQ0FjWE1u?= =?iso-2022-jp?B?MVAwcS9NQUw3L3NRWTdLcXBjVDc4VEZiOVJlc1hGQ0t1M2FHaUQ5bXcr?= =?iso-2022-jp?B?azY1ajJQbUI0bFJoY01XNXFnaklHOVpVUk40MTJrTEMrSFFiK2lqeGlr?= =?iso-2022-jp?B?VTBFZzM4c0FybXlUVGUxekQ0d0NxWFp3M0ZCTEZhYVJTcEpsaFdPUWV2?= =?iso-2022-jp?B?Y3NBTXEwUU55VGl1QUtIdWkvbm5kVGNFVjVPS25GaDBoSVNXNWluekRF?= =?iso-2022-jp?B?TGZIaFZlNlF2ZWNSVGFYdDljQ0ZQR053R0lsdzUzTDh0MW53WWlFUGN2?= =?iso-2022-jp?B?NnlaZA==?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR10MB6603.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3928ee4-f00b-4b6b-eb9b-08dc9c0b6dd6 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2024 09:26:48.0646 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ttCgh2PsPyBuGjt1peYsGCzSnSNcaDe3goO1WFyEQ2sfMn1K6VnJ/idw/08r8X5ILCjbzoNLbqEWY8bfGlb9lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH4PR10MB8099 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: Fri, 05 Jul 2024 11:02:07 -0700 Resent-From: davidhsieh@ami.com Reply-To: devel@edk2.groups.io,davidhsieh@ami.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: iK5pRDG5V2RkEVjxwIKDFYJzx7686176AA= Content-Language: zh-TW Content-Type: multipart/alternative; boundary="_000_PH7PR10MB660380A3E441E0E9376897D3D1DE2PH7PR10MB6603namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=iHYalj7w; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_PH7PR10MB660380A3E441E0E9376897D3D1DE2PH7PR10MB6603namp_ Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Problem: The NX bit in page table is not expected for new allocated EfiBootServicesC= ode if bit7(EfiConventionalMemory) is zero and bit0(EfiReservedMemoryType) is o= ne of PcdDxeNxMemoryProtectionPolicy. Flow: When bit0 of PcdDxeNxMemoryProtectionPolicy is set to 1, the EfiReservedMem= oryType attribute is EFI_MEMORY_XP, the NX bit is set for EfiReservedMemoryType memory in InitializeDxeNxMemory= ProtectionPolicy(). In CoreInternalAllocatePages, if request a specific address but can't be fo= und in current memory map, it does a special =1B$B!H=1B(Bmemory promotion=1B$B!I=1B(B. PromoteMemoryResource() is called to find memory resource and add UNTESTED = memory region to be system memory. The type of UNTESTED memory is EfiGcdMemoryTypeReserved. In CoreAddRange(), the new memory resource is added to allocable system mem= ory resource, the new type is EfiConventionalMemory but the memory attribute is not reall= y changed, NX bit is still set. Before return to caller, ApplyMemoryProtectionPolicy() is used to convert m= emory attribute, however, both bit7(EfiConventionalMemory) and bit3(EfiBootServicesCode) are= zero, memory attribute is not changed. NX bit is still set. AllocatePages returns a EfiBootServicesCode memory but its NX bit is set. -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission= . -=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 (#119807): https://edk2.groups.io/g/devel/message/119807 Mute This Topic: https://groups.io/mt/107058325/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- --_000_PH7PR10MB660380A3E441E0E9376897D3D1DE2PH7PR10MB6603namp_ Content-Type: text/html; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable

Problem:

The NX bit in page table is not= expected for new allocated EfiBootServicesCode

if bit7(EfiConventionalMemory) = is zero and bit0(EfiReservedMemoryType) is one of PcdDxeNxMemoryProtectionP= olicy.

 

Flow:

When bit0 of PcdDxeNxMemoryProt= ectionPolicy is set to 1, the EfiReservedMemoryType attribute is EFI_MEMORY= _XP,

the NX bit is set for EfiReserv= edMemoryType memory in InitializeDxeNxMemoryProtectionPolicy().<= /span>

 

 

In CoreInternalAllocatePages, i= f request a specific address but can't be found in current memory map,

it does a special =1B$B!H=1B(Bm= emory promotion=1B$B!I=1B(B.

PromoteMemoryResource() is call= ed to find memory resource and add UNTESTED memory region to be system memo= ry.

The type of UNTESTED memory is = EfiGcdMemoryTypeReserved.

 

In CoreAddRange(), the new memo= ry resource is added to allocable system memory resource,=

the new type is EfiConventional= Memory but the memory attribute is not really changed, NX bit is still set.=

 

Before return to caller, ApplyM= emoryProtectionPolicy() is used to convert memory attribute,

however, both bit7(EfiConventio= nalMemory) and bit3(EfiBootServicesCode) are zero, memory attribute is not = changed.

NX bit is still set.=

 

AllocatePages returns a EfiBoot= ServicesCode memory but its NX bit is set.

-The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are on notice that any distribution of = this message, in any form, is strictly prohibited. Please promptly notify t= he sender by reply e-mail or by telephone at 770-246-8600, and then delete = or destroy all copies of the transmission.
_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#119807) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_PH7PR10MB660380A3E441E0E9376897D3D1DE2PH7PR10MB6603namp_--