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

Re: [Xen-users] Reading a DomU's memory from Dom0 or Xen hypervisor



On Fri, Oct 06, 2017 at 04:01:29PM +0000, Brett Stahlman wrote:
> On Fri, Oct 6, 2017 at 3:51 AM, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
> > On Thu, Oct 05, 2017 at 05:51:39PM +0000, Brett Stahlman wrote:
> >> I'd like to be able to read specific memory locations within a DomU,
> >> either by guest-physical or guest-virtual address, and I'm wondering
> >> what the Xen-provided options in this area are. I've seen
> >> documentation on "grant tables", but that mechanism seems tailored
> >> towards communication between front and back-end drivers. All I want
> >> to do is allow code in either Dom0 or the hypervisor itself to read
> >> specific memory ranges within a specific DomU. I notice there's a
> >> raw_copy_from_guest() function (guestcopy.c), which looks like it
> >> could be useful. However, the hardcoding of "current->domain" in the
> >> call to get_page_from_gva() leads me to suspect that it's intended for
> >> use only in a hypercall. Is there a standard way to read memory from
> >> an *arbitrary* guest, either using guest-physical or guest-virtual
> >> addresses? If so, is it possible to do it from Dom0 without modifying
> >> the Xen hypervisor?
> >>
> >> Links to relevant documentation or example source code would be
> >> greatly appreciated...
> >
> > AFAICT you want to take a look at the foreignmemory library. It allows
> > you to map DomU memory from Dom0 user-space [0].
> 
> Hmm... Just noticed that the foreignmemory mapping code was factored
> out of libxc and into libxenforeignmemory in commit 324869 (Xen 4.7).
> So it looks like there was no alternative to the libxc functions until
> fairly recently. I'll probably try using the libxenforeignmemory
> functions (tools/libs/foreignmemory) directly, unless someone can give
> me a reason to prefer the libxc wrapper...

libxc doesn't have a stable interface, libxenforeignmemory OTOH is
stable, so you should aim at using the later, or else you
implementation might be tied to a specific Xen version.

Roger.

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

 


Rackspace

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