From: Tim Deegan Subject: Re: Intercepting memory operations of a guest Date: Mon, 8 Dec 2008 10:12:17 +0000 Message-ID: <20081208101217.GQ25331@york.uk.xensource.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Sina Bahram Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org At 01:15 -0500 on 07 Dec (1228612537), Sina Bahram wrote: > #1: Is there anyway possible to trap/insert some code at/hook into, any > modification of a PV guest's page table. Anything like a hypercall handler I > can plugin to, a function or series of functions that always gets called, > something I can provide a call back to, or anything else? PV guest pagetable modifications are made through the MMU hypercalls in arch/x86/mm.c, and the ptwr functions. Eventually, I believer they all call down to adjust_guest_l*e() or alloc_l*_table(). Or, you could enable shadow pagetables and intercept shadow_set_l*e() and sh_destroy_l*_shadow() in arch/x86/mm/shadow/multi.c Intercepting those points doesn't catch _every_ change to a guest pagetable but it is guaranteed to catch changes that could be seen by the hardware MMU. > Also, would such activities be easier or more difficult with hvm guests? If you're using shadow mode, then the interception points would be the same. For hap (aka NPT/EPT) I can't think of an easy way to intercept pagetable changes. Cheers, Tim. -- Tim Deegan Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]