From: Tim Deegan Subject: Re: [PATCH v1 0/2] Extend ioreq-server to support page write protection Date: Wed, 13 Aug 2014 10:38:33 +0200 Message-ID: <20140813083833.GB28131@deinos.phlegethon.org> References: <20140806150037.GA14744@laptop.dumpdata.com> <53E33C90020000780002A00D@mail.emea.novell.com> <53E48B26020000780002A4E9@mail.emea.novell.com> <76A3A946BA26DE4F9D9D5090FFA4A64932DA6F@SHSMSX101.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <76A3A946BA26DE4F9D9D5090FFA4A64932DA6F@SHSMSX101.ccr.corp.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Ye, Wei" Cc: "Tian, Kevin" , "keir@xen.org" , "ian.campbell@citrix.com" , "stefano.stabellini@eu.citrix.com" , "ian.jackson@eu.citrix.com" , "Dugger, Donald D" , "xen-devel@lists.xen.org" , "Paul.Durrant@citrix.com" , "Lv, Zhiyuan" , Jan Beulich , "Zhang, Yang Z" List-Id: xen-devel@lists.xenproject.org At 23:15 +0000 on 12 Aug (1407881757), Ye, Wei wrote: > Some summary of the discussion: > > Without vt-d page fault support, a general write-protection is not > possible. It's impossible to protect the write of both CPU and DMA > path. But note that XenGT itself doesn't use VT-d, and there is no > another usage of having another device DMA to GPU resource. None that you're aware of. But there might be some out-of-tree users? > Or even > other device use the protect page for its DMA buffer, like a > malicious guest, there is no security hole since it can only access > it's our memory range. Not true at all! If the guest has a read-only mapping it must be read-only for a reason. For example, it might have a read-only grant mapping of another VM's memory. Or an out-of-VM security tool might be enforcing W^X permissions. > So, just keep protecting the CPU write path may be feasible for this moment. I don't think so. > Another way is treat the page as MMIO ranges(means removing mapping > in both EPD/VT-D page table). In this way, both read/write access > should be forwarded and emulated. For XenGT usage case, we observed > that for the Linux guest, there is no read access to the ppgtt page > tables. And for the windows guest, the read access is just about 20% > of write. The read overhead is relatively small, so treat the pages > as MMIO range may be possible. That might work for XenGT but it doesn't address the general problem at all. AFAICT the only _safe_ way to make a page read-only to a guest that can issue DMA is to remove it from the IOMMU tables - and that means having separate EPT and vtD tables, until hardware support for restartable IOMMU faults comes along. Cheers, Tim.