]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: fix deadlock with prefork
authorEric Blake <eblake@redhat.com>
Fri, 19 Jul 2013 15:07:19 +0000 (09:07 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 19 Jul 2013 15:15:22 +0000 (09:15 -0600)
Attempts to start a domain with both SELinux and DAC security
modules loaded will deadlock; latent problem introduced in commit
fdb3bde and exposed in commit 29fe5d7.  Basically, when recursing
into the security manager for other driver's prefork, we have to
undo the asymmetric lock taken at the manager level.

Reported by Jiri Denemark, with diagnosis help from Dan Berrange.

* src/security/security_stack.c (virSecurityStackPreFork): Undo
extra lock grabbed during recursion.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/security/security_stack.c

index ed69b9c256fbd4b0ba9eca31544237123c9f6de7..0a0dc92241e9d963bc0e46794f0669a832b78ade 100644 (file)
@@ -127,6 +127,11 @@ virSecurityStackPreFork(virSecurityManagerPtr mgr)
             rc = -1;
             break;
         }
+        /* Undo the unbalanced locking left behind after recursion; if
+         * PostFork ever delegates to driver callbacks, we'd instead
+         * need to recurse to an internal method that does not regrab
+         * a lock. */
+        virSecurityManagerPostFork(item->securityManager);
     }
 
     return rc;