WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] PATCH: Fix file descriptor leak in blktapctrl

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] PATCH: Fix file descriptor leak in blktapctrl
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Date: Sat, 28 Jul 2007 01:46:56 +0100
Delivery-date: Fri, 27 Jul 2007 17:44:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
The blktapctrl process is responsible for spawning individual tapdisk 
processes. It does this using the 'system' method, but unfortunately none
of its file descriptors have the close-on-exec flag set. The parent blktapctl
process opens a couple of unix domain sockets per-tapdisk it spawns. So the
first tapdisk get 2 FDs leaked to it, the second gets 4 FDs leaked to it, the
3rd gets 6 and so on. The use of 'system' also unneccessarily invokes the
shell. So the attached patch replaces system with fork/execvp, and explicitly
closes all file handles upto _SC_OPEN_MAX

  Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

Attachment: xen-blktap-fd-leak.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] PATCH: Fix file descriptor leak in blktapctrl, Daniel P. Berrange <=