From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH V2] arm: p2m.c bug-fix: hypervisor hang on __p2m_get_mem_access Date: Wed, 3 Feb 2016 11:48:42 +0000 Message-ID: <1454500122.25207.88.camel@citrix.com> References: <1453897475-19448-1-git-send-email-czuzu@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1453897475-19448-1-git-send-email-czuzu@bitdefender.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: Corneliu ZUZU , xen-devel@lists.xen.org Cc: Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 2016-01-27 at 14:24 +0200, Corneliu ZUZU wrote: > When __p2m_get_mem_access gets called, the p2m lock is already taken > by either get_page_from_gva or p2m_get_mem_access. > > Possible code paths: > 1) -> get_page_from_gva > -> p2m_mem_access_check_and_get_page > -> __p2m_get_mem_access > 2) -> p2m_get_mem_access > -> __p2m_get_mem_access > > In both cases if __p2m_get_mem_access subsequently gets to > call p2m_lookup (happens if !radix_tree_lookup(...)), a hypervisor > hang will occur, since p2m_lookup also spin-locks on the p2m lock. > > This bug-fix simply replaces the p2m_lookup call from > __p2m_get_mem_access > with a call to __p2m_lookup. > > Following Ian's suggestion, we also add an ASSERT to ensure that > the p2m lock is taken upon __p2m_get_mem_access entry. > > Signed-off-by: Corneliu ZUZU Acked + applied, thanks.