From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 05F7C21B00DC1 for ; Thu, 16 Nov 2017 17:33:14 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2017 17:37:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,406,1505804400"; d="scan'208";a="150320515" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 16 Nov 2017 17:37:23 -0800 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Nov 2017 17:37:23 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Nov 2017 17:37:22 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Fri, 17 Nov 2017 09:37:21 +0800 From: "Yao, Jiewen" To: "Wang, Jian J" , "edk2-devel@lists.01.org" CC: "Zeng, Star" , Laszlo Ersek , "Ard Biesheuvel" Thread-Topic: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging capabilities Thread-Index: AQHTXqxSpKbB1DxdEUO6PAJ7rJxgRaMXyueQ Date: Fri, 17 Nov 2017 01:37:20 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA20F2C@shsmsx102.ccr.corp.intel.com> References: <20171116072700.11456-1-jian.j.wang@intel.com> <20171116072700.11456-2-jian.j.wang@intel.com> In-Reply-To: <20171116072700.11456-2-jian.j.wang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWE5ODJiZDQtODNhZC00MTg4LTg3NWYtOTA4OWFjZjIyY2ZhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJTOXdPQUNibzNjcEMxd1R5c3hBRFVYd2x5SW94N1wvQ0JCMk94Y3VSUWFcL0YxM3ZIQTFuNUphNFZJOEJ2MGhUSEUifQ== x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging capabilities X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Nov 2017 01:33:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable HI I have 2 comments: 1) I do not think we need mention: WORKAROUND. I suggest we just use "NOTE". We have similar example before, see MdePkg\Library\BasePeCoffLib\BasePeCoff= .c // // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic= value=20 // in the PE/COFF Header. If the MachineType is Itanium(IA64) and = the=20 // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR3= 2_MAGIC // then override the returned value to EFI_IMAGE_NT_OPTIONAL_HDR64_= MAGIC // 2) I agree with Star. I think we should merge the final result. The suggestion before is: *Keep current UEFI memory map unchanged.* Changing it brings lots of risk without validating all UEFI OS. Thank you Yao Jiewen > -----Original Message----- > From: Wang, Jian J > Sent: Thursday, November 16, 2017 3:27 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Zeng, Star ; > Laszlo Ersek ; Ard Biesheuvel > Subject: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging capab= ilities >=20 > Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as really > set attributes and change memory paging attribute accordingly. > But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by > value from Capabilities in GCD memory map. This might cause > boot problems. Clearing all paging related capabilities can > workaround it. The code added in this patch is supposed to > be removed once the usage of EFI_MEMORY_DESCRIPTOR.Attribute > is clarified in UEFI spec and adopted by both EDK-II Core and > all supported OSs. >=20 > Cc: Jiewen Yao > Cc: Star Zeng > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > MdeModulePkg/Core/Dxe/Mem/Page.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c > b/MdeModulePkg/Core/Dxe/Mem/Page.c > index c9219cc068..783b576e35 100644 > --- a/MdeModulePkg/Core/Dxe/Mem/Page.c > +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c > @@ -1829,6 +1829,23 @@ CoreGetMemoryMap ( > // > BufferSize =3D ((UINT8 *)MemoryMap - (UINT8 *)MemoryMapStart); >=20 > + // > + // WORKAROUND: Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute > as really > + // set attributes and change memory paging attribute > accordingly. > + // But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned > by > + // value from Capabilities in GCD memory map. This might > cause > + // boot problems. Clearing all paging related capabilities= can > + // workaround it. Following code is supposed to be removed > once > + // the usage of EFI_MEMORY_DESCRIPTOR.Attribute is clarifi= ed > in > + // UEFI spec and adopted by both EDK-II Core and all > supported > + // OSs. > + // > + while (MemoryMapStart < MemoryMap) { > + MemoryMapStart->Attribute &=3D ~(UINT64)(EFI_MEMORY_RP | > EFI_MEMORY_RO | > + EFI_MEMORY_XP); > + MemoryMapStart =3D NEXT_MEMORY_DESCRIPTOR(MemoryMapStart, > Size); > + } > + > Status =3D EFI_SUCCESS; >=20 > Done: > -- > 2.14.1.windows.1