From mboxrd@z Thu Jan 1 00:00:00 1970 From: Spencer Michaels Subject: Re: Reading guest page flags Date: Fri, 14 Sep 2018 01:01:33 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5930791900962056223==" Return-path: Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1g0j2y-0003wi-Pz for xen-devel@lists.xenproject.org; Fri, 14 Sep 2018 08:01:48 +0000 Received: by mail-wr1-x435.google.com with SMTP id 20-v6so9350239wrb.12 for ; Fri, 14 Sep 2018 01:01:47 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" To: Razvan Cojocaru Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org --===============5930791900962056223== Content-Type: multipart/alternative; boundary="00000000000022b6810575d03c01" --00000000000022b6810575d03c01 Content-Type: text/plain; charset="UTF-8" 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 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. > --00000000000022b6810575d03c01 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 writ= e 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 <rcojoc= aru@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 a= s 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 eith= er
> 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.
--00000000000022b6810575d03c01-- --===============5930791900962056223== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============5930791900962056223==--