From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: PATCH: Set close-on-exec flag for QEMU disks Date: Mon, 05 Mar 2007 15:23:43 -0600 Message-ID: <45EC8A5F.3020308@us.ibm.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com, "Daniel P. Berrange" List-Id: xen-devel@lists.xenproject.org Keir Fraser wrote: > On 2/3/07 21:40, "Daniel P. Berrange" wrote: > > >> QEMU does not currently set the close-on-exec flag after opening its virtual >> disk images. This causes problems when it later runs the /etc/xen/qemu-ifup >> script because the file descriptors get propagated to networking commands >> like brctl / ifconfig. The SELinux policy quite rightly does not allow the >> networking scripts to access the virtual disk images, so these inherited >> file descriptors for AVC denials to be logged. >> >> The attached patch modifies all the QEMU disk driver backends to make sure >> the close-on-exec flag is turned on >> > > It would be nicer to implement an open_cloexec() function in e.g., vl.c to > do the open() and fcntl() in one go and in one place. > There are few areas where scripts are executed. Why not just introduce an exec() wrapper that closes file descriptors appropriately. That makes it less likely that this problem will occur in the future. Regards, Anthony Liguori > There are lots of uses of open() throughout the qemu sources and the patch > only fixes up a subset of them -- is this correct? > > -- Keir > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >