[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.