From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel P. Berrange" Subject: Re: [PATCH qemu-kvm] device-assignment: add config fd qdev property Date: Thu, 20 May 2010 11:06:26 +0100 Message-ID: <20100520100626.GD28087@redhat.com> References: <20100519190041.GK28275@x200.localdomain> <4BF4398B.50902@codemonkey.ws> Reply-To: "Daniel P. Berrange" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Chris Wright , kvm@vger.kernel.org, Alex Williamson To: Anthony Liguori Return-path: Received: from mx1.redhat.com ([209.132.183.28]:20133 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753035Ab0ETKGa (ORCPT ); Thu, 20 May 2010 06:06:30 -0400 Content-Disposition: inline In-Reply-To: <4BF4398B.50902@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, May 19, 2010 at 02:18:35PM -0500, Anthony Liguori wrote: > On 05/19/2010 02:00 PM, Chris Wright wrote: > >When libvirt launches a guest it first chowns the relevenat > >/sys/bus/pci/.../config file for an assigned device then drops privileges. > > > >This causes an issue for device assignment because despite being file > >owner, the sysfs config space file checks for CAP_SYS_ADMIN before > >allowing access to device dependent config space. > > > >This adds a new qdev configfd property which allows libvirt to open the > >sysfs config space file and give qemu an already opened file descriptor. > >Along with a change pending for the 2.6.35 kernel, this allows the > >capability check to compare against privileges from when the file was > >opened. > > > >Signed-off-by: Chris Wright > > > > An fd as a qdev property seems like a bad idea to me. I'm not sure I > have a better suggestion though. The entire requirement to pass the open FD to qemu is a bad idea, but the kernel makes it impossible to do otherwise :-( Personally I wish the kernel just used the file ownership, so we could chown() the sysfs file to 'qemu' user in a normal manner :-( Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|