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

Re: [Xen-devel] [PATCH] Ensure FD_CLOEXEC is set on all XenD file handle

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Ensure FD_CLOEXEC is set on all XenD file handles
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Date: Tue, 15 Aug 2006 14:43:30 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 15 Aug 2006 06:44:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C107580D.E4A%Keir.Fraser@xxxxxxxxxxxx>
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>
References: <20060815012357.GA28193@xxxxxxxxxx> <C107580D.E4A%Keir.Fraser@xxxxxxxxxxxx>
Reply-to: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Tue, Aug 15, 2006 at 10:53:01AM +0100, Keir Fraser wrote:
> 
> On 15/8/06 2:23 am, "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> 
> > BTW, the patches were prepared against the latest Xen userspace code in
> > Fedora Core 6, test2 - this is trailing xen-unstable by a couple of weeks
> > but I think they should still apply. If people agree with the approach
> > taken in the patch I'll re-diff against xen-unstable before posting again.
> 
> The patches look okay to me. Please re-send with a signed-off-by line.

I'm also attaching one extra patch 'xen-xend-logging-cloexec.patch' which
sets the FD_CLOEXEC flag on the /var/log/xend.log  file. I'm not entirely
happy with this patch though because it accesses the private 'self.stream'
field in its superclass. Unfortunately the entire python logging class
hierarchy is 'designed'  on the principle of accessing  private class
members from superclasses, so I don't see any immediately obvious alternate
way to set FD_CLOEXEC on the log file.


A much more invasive patch to XenD would be to locate all places where we
call fork / exec and in between the forking & execing iterate over all
file handles explicitly setting FD_CLOEXEC, eg the equiv of this C code,
but in python

     pid = fork()
     if (pid == 0) {
        open_max = sysconf (_SC_OPEN_MAX);
        for (i = 0; i < open_max; i++)
            fcntl (i, F_SETFD, FD_CLOEXEC);

        exec(...)
     }

We'd also need to find all places where we call 'spawn' and replace this call
with a fork/exec pair.

Attached the 3 previous patches & the new one to this mail. I've tested that
they apply without trouble to latest xen-unstable.hg

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

Regards
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-xc-cloexec.patch
Description: Text document

Attachment: xen-xs2-cloexec.patch
Description: Text document

Attachment: xen-xend2-cloexec.patch
Description: Text document

Attachment: xen-xend-logging-cloexec.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>