From: Ian Campbell Subject: Re: [PATCH v3] xen/arm: p2m: Correctly flush TLB in create_p2m_entries Date: Wed, 15 Jan 2014 14:13:24 +0000 Message-ID: <1389795204.3793.57.camel@kazak.uk.xensource.com> References: <1389706615-9578-1-git-send-email-julien.grall@linaro.org> <1389710646.12434.66.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1W3RE1-0005Rn-6m for xen-devel@lists.xenproject.org; Wed, 15 Jan 2014 14:13:45 +0000 In-Reply-To: <1389710646.12434.66.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org On Tue, 2014-01-14 at 14:44 +0000, Ian Campbell wrote: > On Tue, 2014-01-14 at 13:36 +0000, Julien Grall wrote: > > The p2m is shared between VCPUs for each domain. Currently Xen only flush > > TLB on the local PCPU. This could result to mismatch between the mapping in the > > p2m and TLBs. > > > > Flush TLB entries used by this domain on every PCPU. The flush can also be > > moved out of the loop because: > > - ALLOCATE: only called for dom0 RAM allocation, so the flush is never called > > - INSERT: if valid = 1 that would means with have replaced a > > page that already belongs to the domain. A VCPU can write on the wrong page. > > This can happen for dom0 with the 1:1 mapping because the mapping is not > > removed from the p2m. > > - REMOVE: except for grant-table (replace_grant_host_mapping), each > > call to guest_physmap_remove_page are protected by the callers via a > > get_page -> .... -> guest_physmap_remove_page -> ... -> put_page. So > > the page can't be allocated for another domain until the last put_page. > > - RELINQUISH : the domain is not running anymore so we don't care... > > > > Also avoid leaking a foreign page if the function is INSERTed a new mapping > > on top of foreign mapping. > > > > Signed-off-by: Julien Grall > > Acked-by: Ian Campbell > > Release hat: There are two major issues here, one is not broadcasting > the TLB flush, which is a potential security issue (another VCPU can > keep accessing a page after it is freed). The other is a potential DoS > by leaking a reference on a foreign page, which would stop that domain > from ever being destroyed. > > Either of these two issues would be enough to justify taking this change > for 4.4. > > We are cutting rc2 at the moment, I will apply after that is out the > way. Done, on top of "xen/arm: correct flush_tlb_mask behaviour".