All of lore.kernel.org
 help / color / mirror / Atom feed
* Reading guest page flags
@ 2018-09-13 17:29 Spencer Michaels
  2018-09-13 17:47 ` Razvan Cojocaru
  0 siblings, 1 reply; 4+ messages in thread
From: Spencer Michaels @ 2018-09-13 17:29 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 414 bytes --]

Hello,

I'm writing an application that can read/write guest memory, and as part of
that I need to check whether the page being manipulated is
readable/writable by the guest itself. Does Xen have an API that would
allow me to read the flags of an arbitrary page on a guest, given either
its address or its PFN? I've only been able to find functions that update
the existing memory mappings, but none to read them.

[-- Attachment #1.2: Type: text/html, Size: 491 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading guest page flags
  2018-09-13 17:29 Reading guest page flags Spencer Michaels
@ 2018-09-13 17:47 ` Razvan Cojocaru
  2018-09-13 18:45   ` Tamas K Lengyel
  2018-09-14  8:01   ` Spencer Michaels
  0 siblings, 2 replies; 4+ messages in thread
From: Razvan Cojocaru @ 2018-09-13 17:47 UTC (permalink / raw)
  To: Spencer Michaels, xen-devel

On 9/13/18 8:29 PM, Spencer Michaels wrote:
> I'm writing an application that can read/write guest memory, and as part
> of that I need to check whether the page being manipulated is
> readable/writable by the guest itself. Does Xen have an API that would
> allow me to read the flags of an arbitrary page on a guest, given either
> its address or its PFN? I've only been able to find functions that
> update the existing memory mappings, but none to read them.

If you mean EPT, yes: look at xc_get_mem_access() in xenctrl.h / libxc.
If you mean "regular" PTEs, no - you'd have to write your own code to
retrieve that.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading guest page flags
  2018-09-13 17:47 ` Razvan Cojocaru
@ 2018-09-13 18:45   ` Tamas K Lengyel
  2018-09-14  8:01   ` Spencer Michaels
  1 sibling, 0 replies; 4+ messages in thread
From: Tamas K Lengyel @ 2018-09-13 18:45 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: sxmichaels, Xen-devel

On Thu, Sep 13, 2018 at 11:48 AM Razvan Cojocaru
<rcojocaru@bitdefender.com> wrote:
>
> On 9/13/18 8:29 PM, Spencer Michaels wrote:
> > I'm writing an application that can read/write guest memory, and as part
> > of that I need to check whether the page being manipulated is
> > readable/writable by the guest itself. Does Xen have an API that would
> > allow me to read the flags of an arbitrary page on a guest, given either
> > its address or its PFN? I've only been able to find functions that
> > update the existing memory mappings, but none to read them.
>
> If you mean EPT, yes: look at xc_get_mem_access() in xenctrl.h / libxc.
> If you mean "regular" PTEs, no - you'd have to write your own code to
> retrieve that.

LibVMI does that for guest PTEs:
https://github.com/libvmi/libvmi/blob/master/libvmi/libvmi.h#L936

Tamas

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading guest page flags
  2018-09-13 17:47 ` Razvan Cojocaru
  2018-09-13 18:45   ` Tamas K Lengyel
@ 2018-09-14  8:01   ` Spencer Michaels
  1 sibling, 0 replies; 4+ messages in thread
From: Spencer Michaels @ 2018-09-14  8:01 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1094 bytes --]

Thanks! Sorry, I should have been more specific - I do indeed mean the
regular guest PTEs (and I'm using PV guests which as I understand don't use
EPT anyway). So, it seems I'll have to write my own code for this. I'll
take a look at libvmi's implementation; if anyone knows any other libraries
/ programs that read guest PTEs, that would be helpful to know as well.

On Thu, Sep 13, 2018, 10:47 AM Razvan Cojocaru <rcojocaru@bitdefender.com>
wrote:

> On 9/13/18 8:29 PM, Spencer Michaels wrote:
> > I'm writing an application that can read/write guest memory, and as part
> > of that I need to check whether the page being manipulated is
> > readable/writable by the guest itself. Does Xen have an API that would
> > allow me to read the flags of an arbitrary page on a guest, given either
> > its address or its PFN? I've only been able to find functions that
> > update the existing memory mappings, but none to read them.
>
> If you mean EPT, yes: look at xc_get_mem_access() in xenctrl.h / libxc.
> If you mean "regular" PTEs, no - you'd have to write your own code to
> retrieve that.
>

[-- Attachment #1.2: Type: text/html, Size: 1482 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-14  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13 17:29 Reading guest page flags Spencer Michaels
2018-09-13 17:47 ` Razvan Cojocaru
2018-09-13 18:45   ` Tamas K Lengyel
2018-09-14  8:01   ` Spencer Michaels

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.