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=star.zeng@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 9DE66220D4BE1 for ; Tue, 21 Nov 2017 23:25:59 -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; 21 Nov 2017 23:30:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,436,1505804400"; d="scan'208";a="8162913" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 21 Nov 2017 23:30:14 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 21 Nov 2017 23:30:14 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Wed, 22 Nov 2017 15:30:12 +0800 From: "Zeng, Star" To: "Wang, Jian J" , "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: Laszlo Ersek , Ard Biesheuvel , "Kinney, Michael D" , "Zeng, Star" Thread-Topic: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging capabilities Thread-Index: AQHTXqxSJ+zb18lgYkGCDDf5StZyWqMXRcIAgAAT7gCACK6FQA== Date: Wed, 22 Nov 2017 07:30:11 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9BA52B@shsmsx102.ccr.corp.intel.com> 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: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWE5ODJiZDQtODNhZC00MTg4LTg3NWYtOTA4OWFjZjIyY2ZhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJTOXdPQUNibzNjcEMxd1R5c3hBRFVYd2x5SW94N1wvQ0JCMk94Y3VSUWFcL0YxM3ZIQTFuNUphNFZJOEJ2MGhUSEUifQ== 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: Wed, 22 Nov 2017 07:25:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng if the feedback from Jiewen (a= bout comments) and Laszlo (about MemoryMapStart) has been addressed, and th= e merging will be done in a separated patch. Thanks, Star -----Original Message----- From: Wang, Jian J=20 Sent: Friday, November 17, 2017 10:49 AM To: Yao, Jiewen ; edk2-devel@lists.01.org Cc: Zeng, Star ; Laszlo Ersek ; Ard= Biesheuvel ; Kinney, Michael D Subject: RE: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging cap= abilities 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=20 > ; Ard Biesheuvel > Subject: RE: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all=20 > 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=20 > magic 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.*=20 > 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=20 > > ; Laszlo Ersek ; Ard=20 > > Biesheuvel > > > Subject: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging > capabilities > > > > Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as really set=20 > > attributes and change memory paging attribute accordingly. > > But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by value=20 > > from Capabilities in GCD memory map. This might cause boot problems.=20 > > Clearing all paging related capabilities can workaround it. The code=20 > > added in this patch is supposed to be removed once the usage of=20 > > EFI_MEMORY_DESCRIPTOR.Attribute is clarified in UEFI spec and=20 > > 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