[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Exposing MFN to Host (Dom 0)



On 26/05/17 15:40, Carter Yagemann wrote:
> Hi,
>
> A few months ago I extended a prototyping hypervisor called Bareflank to
> include support for Intel Processor Trace (PT) and now I'm trying to
> implement similar functionality in Xen for research. My goal is to
> leverage the existing interfaces as much as possible to minimize the
> number of direct modifications to the hypervisor code.
>
> I plan to control PT entirely from the host by leveraging libVMI and
> writing directly into PT's MSRs, but PT only uses physical addresses, so
> the piece that I'm missing is a way for the host to translate a guest
> physical address into a machine physical address (GFN => MFN).
>
> Specifically, I need to be able to take the physical address in a
> guest's CR3 register and translate it into the machine physical address
> and I need a way for host to allocate new pages and get their MFNs so PT
> has somewhere to write its trace data.

While I appreciate your intention to not blindly modify the hypervisor
for the sake of it, I'd also suggest considering the problem as a whole
and making changes in the proper layers.

Intel PT has already been discussed on xen-devel before, and it is
unsafe for anyone but Xen to actually program the hardware interface. 
As such, libVMI should not (from a safety point of view) be in a
position to do what you want.

As for translating GFNs to MFNs, there are good reasons why you cant do
this from outside of Xen.  With PoD or Paging, a GFN which exists may
not have a mapping to a real MFN.  This is why mapping hypercalls exist
instead which take care of ensuring that such a mapping eventually
exists, or fails cleanly while doing so.

If you insist on doing it from outside Xen, you can cheat with a PV
guest by creating a foreign mapping, and reading the PTE back, but you
still have no way to drive PT directly.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.