[libvirt] [PATCH] Avoid async signal safety problem in glibc's setxid

Daniel P. Berrange berrange at redhat.com
Mon Nov 18 16:13:57 UTC 2013


On Mon, Nov 18, 2013 at 05:09:31PM +0100, Pavel Hrdina wrote:
> On 15.11.2013 17:20, Daniel P. Berrange wrote:
> >The glibc setxid is supposed to be async signal safe, but
> >libc developers confirm that it is not. This causes a problem
> >when libvirt_lxc starts the FUSE thread and then runs clone()
> >to start the container. If the clone() was done before the
> >FUSE thread has completely started up, then the container
> >will hang in setxid after clone().
> >
> >The fix is to avoid creating any threads until after the
> >container has been clone()'d. By avoiding any threads in
> >the parent, the child is no longer required to run in an
> >async signal safe context, and we thus avoid the glibc
> >bug.
> >
> >Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> 
> [...]
> 
> >diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
> >index 9d12832..88e122e 100644
> >--- a/src/lxc/lxc_fuse.c
> >+++ b/src/lxc/lxc_fuse.c
> 
> [...]
> 
> >@@ -364,6 +369,10 @@ int lxcSetupFuse(virLXCFusePtr *f ATTRIBUTE_UNUSED,
> >      return 0;
> >  }
> >
> >+int lxcStartFuse(virLXCFusePtr f ATTRIBUTE_UNUSED)
> >+{
> >+}
> >+
> >  void lxcFreeFuse(virLXCFusePtr *f ATTRIBUTE_UNUSED)
> >  {
> >  }
> 
> Hi Daniel,
> 
> This hunk breaks the build on RHEL-6.4.
> lxc/lxc_fuse.c:374: error: control reaches end of non-void function
> [-Wreturn-type]

Fixed as

commit 784bb73eaa5507375c21f801376a512dc6ae658d
Author: Daniel P. Berrange <berrange at redhat.com>
Date:   Mon Nov 18 16:12:39 2013 +0000

    Add missing 'return 0;' in stub lxcStartFuse() method impl.
    
    Without a 'return 0' in the stub lxcStartFuse() method, the
    compiler warns:
    
    lxc/lxc_fuse.c:374: error: control reaches end of non-void function
    [-Wreturn-type]
    
    Signed-off-by: Daniel P. Berrange <berrange at redhat.com>

diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index 88e122e..d3d8f85 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -371,6 +371,7 @@ int lxcSetupFuse(virLXCFusePtr *f ATTRIBUTE_UNUSED,
 
 int lxcStartFuse(virLXCFusePtr f ATTRIBUTE_UNUSED)
 {
+    return 0;
 }
 
 void lxcFreeFuse(virLXCFusePtr *f ATTRIBUTE_UNUSED)

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list