From: ken mark Subject: Xen EPT modifications and interceptions Date: Wed, 3 Feb 2010 11:00:46 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0766584419==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --===============0766584419== Content-Type: multipart/alternative; boundary=00504502b150c53bda047ea96c95 --00504502b150c53bda047ea96c95 Content-Type: text/plain; charset=ISO-8859-1 We are trying to set page guards in EPT entry to intercept the access to certain guest page on 32-bit hvm guest. Though we have briefly investigated into the p2m module and the ept module in xen, we only got an awkward approach that hacks into the EPT. 1. We depend on ept_set_entry to split super page into normal 4K pages first. 2. We employ the similar way that ept_set_entry has done to find an entry. Once found, we modify its access bit (rwx) violently after the p2m_type_t has applied its rules to these bits. 3. We hook the ept_handle_violation to intercept these ept violations that will cause domain crash and find out if these faults are caused by formal modifications in 2 and settle them. Then we come across several problems: We use map_domain_page to map the ept table that contains the target entry. After changing the access bits in that entry, we use unmap_domain_page to activate the modification. But it seems that when we again map the ept table and fetch the exact entry we've modified just before, our modifications haven't taken effect. Any sometimes the modification will cause interception while in some cases it doesn'. Is there anything to do which our using of map/unmap functions? Or do we need to flush something when we have made the modifications? -- Kenmark --00504502b150c53bda047ea96c95 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable We are trying to set page guards in EPT entry to intercept the access to ce= rtain guest page on 32-bit hvm guest.
Though we have briefly investigate= d into the p2m module and the ept module in xen, we only got an awkward app= roach that hacks into the EPT.
1. We depend on ept_set_entry to split super page into normal 4K pages firs= t.
2. We employ the similar way that ept_set_entry has done to find an e= ntry. Once found, we modify its access bit (rwx) violently after the p2m_ty= pe_t has applied its rules to these bits.
3. We hook the ept_handle_violation to intercept these ept violations that = will cause domain crash and find out if these faults are caused by formal m= odifications in 2 and settle them.
Then we come across sev= eral problems:
We use map_domain_page to map the ept table that contains the target entry.= After changing the access bits in that entry, we use unmap_domain_page to = activate the modification. But it seems that when we again map the ept tabl= e and fetch the exact entry we've modified just before, our modificatio= ns haven't taken effect. Any sometimes the modification will cause inte= rception while in some cases it doesn'. Is there anything to do which o= ur using of map/unmap functions? Or do we need to flush something when we h= ave made the modifications?

--
Kenmark
--00504502b150c53bda047ea96c95-- --===============0766584419== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0766584419==--