From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] kvm: make processes waiting on vcpu mutex killable Date: Mon, 17 Sep 2012 13:47:18 -0300 Message-ID: <20120917164718.GB25815@amt.cnet> References: <20120916085030.GA23495@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1113 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970Ab2IQQr2 (ORCPT ); Mon, 17 Sep 2012 12:47:28 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8HGlSRW008108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Sep 2012 12:47:28 -0400 Content-Disposition: inline In-Reply-To: <20120916085030.GA23495@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Sep 16, 2012 at 11:50:30AM +0300, Michael S. Tsirkin wrote: > vcpu mutex can be held for unlimited time so > taking it with mutex_lock on an ioctl is wrong: > one process could be passed a vcpu fd and > call this ioctl on the vcpu used by another process, > it will then be unkillable until the owner exits. > > Call mutex_lock_killable instead and return status. > Note: mutex_lock_interruptible would be even nicer, > but I am not sure all users are prepared to handle EINTR > from these ioctls. They might misinterpret it as an error. > > Cleanup paths expect a vcpu that can't be used by > any userspace so this will always succeed - catch bugs > by calling BUG_ON. > > Catch callers that don't check return state by adding > __must_check. > > Signed-off-by: Michael S. Tsirkin > --- > > It's a minor bugfix - should we put it in 3.6? Applied to branch 'queue' on the basis its not a regression/critical problem, thanks.