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=jian.j.wang@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 096E52035A7C6 for ; Thu, 16 Nov 2017 18:44:33 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2017 18:48:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,406,1505804400"; d="scan'208";a="5947439" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 16 Nov 2017 18:48:43 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Nov 2017 18:48:43 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Nov 2017 18:48:42 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.175]) with mapi id 14.03.0319.002; Fri, 17 Nov 2017 10:48:40 +0800 From: "Wang, Jian J" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Zeng, Star" , Laszlo Ersek , "Ard Biesheuvel" , "Kinney, Michael D" Thread-Topic: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging capabilities Thread-Index: AQHTXqxSyO5qS8QNzkOTSwcPI466a6MXyueQgAARYSA= Date: Fri, 17 Nov 2017 02:48:40 +0000 Message-ID: References: <20171116072700.11456-1-jian.j.wang@intel.com> <20171116072700.11456-2-jian.j.wang@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503AA20F2C@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503AA20F2C@shsmsx102.ccr.corp.intel.com> Accept-Language: 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 02:44:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 1) Sure. I'll update the wording. 2) I still think this is just a workaround . In the long run, I don't think= the merge is a good idea. It looks like it will "fix" more issues, but act= ually it just "hide" them and would cause more and more workaround in the f= uture. Anyway, if no one else has objections, I'll update the code. > -----Original Message----- > From: Yao, Jiewen > Sent: Friday, November 17, 2017 9:37 AM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Zeng, Star ; Laszlo Ersek ; A= rd > Biesheuvel > Subject: RE: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging > capabilities >=20 > HI > I have 2 comments: >=20 > 1) I do not think we need mention: WORKAROUND. > I suggest we just use "NOTE". >=20 > We have similar example before, see > MdePkg\Library\BasePeCoffLib\BasePeCoff.c > // > // NOTE: Some versions of Linux ELILO for Itanium have an incorrect mag= ic > value > // in the PE/COFF Header. If the MachineType is Itanium(IA64) an= d the > // Magic value in the OptionalHeader is > EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC > // then override the returned value to > EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC > // >=20 > 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. >=20 >=20 > Thank you > Yao Jiewen >=20 >=20 > > -----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 > capabilities > > > > 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. > > > > 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(+) > > > > 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); > > > > + // > > + // 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 assign= ed > > by > > + // value from Capabilities in GCD memory map. This might > > cause > > + // boot problems. Clearing all paging related capabiliti= es can > > + // workaround it. Following code is supposed to be remov= ed > > once > > + // the usage of EFI_MEMORY_DESCRIPTOR.Attribute is clari= fied > > 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; > > > > Done: > > -- > > 2.14.1.windows.1