From: Tim Deegan Subject: Re: shadow2 corrupting PV guest state Date: Mon, 23 Oct 2006 11:26:34 +0100 Message-ID: <20061023102634.GC8271@york.uk.xensource.com> References: <453020EE.4080603@goop.org> <200610230545.k9N5jWF05122@photon.sky.yk.fujitsu.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Return-path: Content-Disposition: inline In-Reply-To: <200610230545.k9N5jWF05122@photon.sky.yk.fujitsu.co.jp> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Doi.Tsunehisa@jp.fujitsu.com Cc: Chris Wright , Michael A Fetterman , Jeremy Fitzhardinge , Xen-devel List-Id: xen-devel@lists.xenproject.org At 14:45 +0900 on 23 Oct (1161614732), Doi.Tsunehisa@jp.fujitsu.com wrote: > Basically, the referencee should not be released during to exist the > referencer, I think. > > In domain_kill phase, domain_relinquish_resource releases a memory > of destroying domain. So, the memory may use other domain. But, P2M > table of the domain exists, then the memory might be corrupted by > gnttab_copy. > > In __gnttab_copy code, it will avoid to corrupt a memory that was > used in destroying domain with __acquire_grant_for_copy and get_page. > But, I think that it has atomicity issue of owner. Are you worried about a race where the foreign domain is destroyed and another domain created, with the same struct domain pointer, and which owns the same frame, between the __acquire_grant_for_copy() and the get_page()? Earlier in __gnttab_copy, we call find_domain_by_id() on the foreign domain, which calls get_domain(), so we're safe from that. Cheers, Tim.