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

Re: [Xen-devel] [PATCH for-4.5 v10 15/19] xen/arm: Temporarily disable mem_access for hypervisor access





On Fri, Sep 26, 2014 at 3:41 PM, Julien Grall <julien.grall@xxxxxxxxxx> wrote:


On 26/09/2014 15:29, Tamas K Lengyel wrote:
As I said, I'm not sure what you are describing exactly. Based on the
p2m type we could already decide if the hypercall should be allowed to
read/write form the page. AFAIU the MMU here is only used as a fast-path
to determine if that's the case.

What I was getting at, its not a good idea to simply disable hypercalls
that use this path when there is a mem_access permission set because it
would reveal that there is a mem_access listener to the guest. So what
I'll do here is pausing the domain when access_in_use is set, temporary
disable the mem_access permissions, let the read/write through, then
re-enable + unpause the domain.

My solution is based on p2m_lookup, i.e getting the p2m type. Even if it's still slow (we can't really use the MMU translation facility), it would still be faster than pausing the domain and modifying twice the p2m. See the code skeleton below:

page = get_gva(...)
if ( !page )
{
   ipa = get ipa from va(va)
   mfn = p2m_lookup(d, ipa, &type);
   if ( mfn == INVALID_PADDR )
     return -EFAULT;
   page = get_page(mfn_to_page(mfn));
   if ( !page )
     return -EFAULT;

   if type check fail
   {
     put_page(page);
     return -EFAULT;
   }
}

You may have to modify a bit the skeleton above to take the p2m->look.

OK, I guess that would work too, just don't use the MMU translation to get the page if it fails to get it via the MMU the first time around and if there are mem_access permissions in the way.

Tamas
 

Regards,

--
Julien Grall

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

 


Rackspace

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