From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 325B420356240 for ; Mon, 4 Dec 2017 22:37:14 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2017 22:41:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,363,1508828400"; d="scan'208";a="9677219" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 04 Dec 2017 22:41:45 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 4 Dec 2017 22:41:44 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 4 Dec 2017 22:41:44 -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; Tue, 5 Dec 2017 14:41:38 +0800 From: "Wang, Jian J" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH v2 0/4] Enable page table write protection Thread-Index: AQHTbNr7XHanUAd61UeqzF6nBcDE0qMzgp0AgADHs+A= Date: Tue, 5 Dec 2017 06:41:38 +0000 Message-ID: References: <20171204083556.19416-1-jian.j.wang@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503AA39A87@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503AA39A87@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWI3MThjZmQtMmU0MS00NGQ5LTlkNGUtNGYxMzRmMDRiZmYwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ4K1N4K0NQNVF1dWx6ZmdzdG9YRVMxZmtiZUZZZmNkXC9uXC9SZmtaSEx4VFdkZTJNTU0rTEJydW9GWDFWdDNSUmwifQ== 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 v2 0/4] Enable page table write protection 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: Tue, 05 Dec 2017 06:37:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I haven't got time to do it in automatic way. V1 may need a shell app to check it, but current implementation might not need it because we now have 2 or 3 continuous 2MB pages to hold all page tables. We just need to verify the page attribute of those 2 or 3 page tables. It's easy to do it in a JTAG debugger manually. > -----Original Message----- > From: Yao, Jiewen > Sent: Tuesday, December 05, 2017 10:32 AM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Yao, Jiewen > Subject: RE: [edk2] [PATCH v2 0/4] Enable page table write protection >=20 > Hi Jian > In V1 review, I suggest to test in UEFI shell env to make sure all page t= able is > read only, with PageTable split in CPU driver. >=20 > May I know if that is done? >=20 > Thank you > Yao Jiewen >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of = Jian > J > > Wang > > Sent: Monday, December 4, 2017 4:36 PM > > To: edk2-devel@lists.01.org > > Subject: [edk2] [PATCH v2 0/4] Enable page table write protection > > > > > v2 changes: > > > a. Enable protection on any newly added page table after DxeIpl. > > > b. Introduce page table pool concept to make page table allocation > > > and protection easier and error free. > > > > Write Protect feature (CR0.WP) is always enabled in driver > UefiCpuPkg/CpuDxe. > > But the memory pages used for page table are not set as read-only in th= e > driver > > DxeIplPeim, after the paging is setup. This might jeopardize the page t= able > > integrity if there's buffer overflow occured in other part of system. > > > > This patch series will change this situation by clearing R/W bit in pag= e attribute > > of the pages used as page table. > > > > Validation works include booting Windows (10/server 2016) and Linux > > (Fedora/Ubuntu) > > on OVMF and Intel real platform. > > > > Jian J Wang (4): > > MdeModulePkg/MdeModulePkg.dec: Add new PCDs and Guid > > MdeModulePkg/PageTablePool.h: Page table pool GUID definition file > > MdeModulePkg/DxeIpl: Mark page table as read-only > > UefiCpuPkg/CpuDxe: Enable protection for newly added page table > > > > MdeModulePkg/Core/DxeIplPeim/DxeIpl.h | 34 +++ > > MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 3 + > > MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 8 +- > > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 315 > > +++++++++++++++++++++- > > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.h | 15 ++ > > MdeModulePkg/Include/Guid/PageTablePool.h | 53 ++++ > > MdeModulePkg/MdeModulePkg.dec | 28 ++ > > UefiCpuPkg/CpuDxe/CpuDxe.c | 17 +- > > UefiCpuPkg/CpuDxe/CpuDxe.h | 2 + > > UefiCpuPkg/CpuDxe/CpuDxe.inf | 3 + > > UefiCpuPkg/CpuDxe/CpuPageTable.c | 329 > > ++++++++++++++++++++++- > > UefiCpuPkg/CpuDxe/CpuPageTable.h | 22 ++ > > 12 files changed, 816 insertions(+), 13 deletions(-) > > create mode 100644 MdeModulePkg/Include/Guid/PageTablePool.h > > > > -- > > 2.14.1.windows.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel