From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v8 02/14] arch/arm: add consistency check to REMOVE p2m changes Date: Thu, 5 Jun 2014 14:50:30 +0100 Message-ID: <1401976230.15729.89.camel@hastur.hellion.org.uk> References: <1401015115-7610-1-git-send-email-avanzini.arianna@gmail.com> <1401015115-7610-3-git-send-email-avanzini.arianna@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1401015115-7610-3-git-send-email-avanzini.arianna@gmail.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: Arianna Avanzini Cc: Ian.Campbell@eu.citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com, dario.faggioli@citrix.com, tim@xen.org, xen-devel@lists.xen.org, julien.grall@citrix.com, etrudeau@broadcom.com, JBeulich@suse.com, andrew.cooper3@citrix.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org On Sun, 2014-05-25 at 12:51 +0200, Arianna Avanzini wrote: > case REMOVE: > { > + unsigned long mfn = pte.p2m.base; > + > + /* > + * Ensure that the guest address given as argument to > + * this function is actually mapped to the specified > + * machine address. maddr here is the machine address > + * given to the function, while mfn is the machine > + * frame number actually mapped to the guest address: > + * check if the two correspond. > + */ > + if ( !pte.p2m.valid || maddr != pfn_to_paddr(mfn) ) > + { > + printk("p2m_remove: nonexistent mapping: " nonexistent is misleading here, since it might be present but not what we think it should be. Say something like: p2m_remove: mapping at %"PRIpaddr" is of mfn %"PRIpaddr" not %"PRIpaddr" as expected and I think it needs to be a gdprintk or something more restircted than a regular printk -- otherwise a guest might be able to spam the console. > + "%"PRIx64" and %"PRIx64"\n", > + pfn_to_paddr(mfn), maddr); The correct format code for a paddr_t is PRIpaddr. > + /* > + * If we have successfully removed other mappings, > + * overload flush local variable to store if we need > + * to flush TLBs. > + */ > + if (count) flush = 1; else flush = 0; > + rc = -EINVAL; > + goto out_flush; > + } > + } > + /* fall through */ Ian.