From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] KVM: MMU: Fix free memory accounting race in mmu_alloc_roots() Date: Tue, 11 May 2010 14:10:21 -0300 Message-ID: <20100511171021.GD9712@amt.cnet> References: <1273482596-11311-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40789 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751438Ab0EKTg5 (ORCPT ); Tue, 11 May 2010 15:36:57 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4BJauDD009930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 May 2010 15:36:57 -0400 Content-Disposition: inline In-Reply-To: <1273482596-11311-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, May 10, 2010 at 12:09:56PM +0300, Avi Kivity wrote: > We drop the mmu lock between freeing memory and allocating the roots; this > allows some other vcpu to sneak in and allocate memory. > > While the race is benign (resulting only in temporary overallocation, not oom) > it is simple and easy to fix by moving the freeing close to the allocation. > > Signed-off-by: Avi Kivity > --- > arch/x86/kvm/mmu.c | 5 ++--- > 1 files changed, 2 insertions(+), 3 deletions(-) Applied, thanks.