From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH for-4.5 v10 15/19] xen/arm: Temporarily disable mem_access for hypervisor access Date: Fri, 26 Sep 2014 15:41:11 +0200 Message-ID: <54256CF7.3030005@linaro.org> References: <1411646212-17041-1-git-send-email-tklengyel@sec.in.tum.de> <1411646212-17041-16-git-send-email-tklengyel@sec.in.tum.de> <5424407D.70904@linaro.org> <54255F7D.8070107@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tamas K Lengyel Cc: Ian Campbell , Tim Deegan , Ian Jackson , "xen-devel@lists.xen.org" , Stefano Stabellini , Andres Lagar-Cavilla , Jan Beulich , Daniel De Graaf , Tamas K Lengyel List-Id: xen-devel@lists.xenproject.org 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. Regards, -- Julien Grall