]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
security: framework for driver PreFork handler
authorEric Blake <eblake@redhat.com>
Wed, 17 Jul 2013 21:35:50 +0000 (15:35 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 18 Jul 2013 21:19:36 +0000 (15:19 -0600)
commitfdb3bde31ccf8ff172abf00ef5aa974b87af2794
treeec045a1a3a15e86ecb26fe2a7d3e5e1903981fea
parentc5d79fb0fc4a680ce4b2a62327b11e6cf7dbe409
security: framework for driver PreFork handler

A future patch wants the DAC security manager to be able to safely
get the supplemental group list for a given uid, but at the time
of a fork rather than during initialization so as to pick up on
live changes to the system's group database.  This patch adds the
framework, including the possibility of a pre-fork callback
failing.

For now, any driver that implements a prefork callback must be
robust against the possibility of being part of a security stack
where a later element in the chain fails prefork.  This means
that drivers cannot do any action that requires a call to postfork
for proper cleanup (no grabbing a mutex, for example).  If this
is too prohibitive in the future, we would have to switch to a
transactioning sequence, where each driver has (up to) 3 callbacks:
PreForkPrepare, PreForkCommit, and PreForkAbort, to either clean
up or commit changes made during prepare.

* src/security/security_driver.h (virSecurityDriverPreFork): New
callback.
* src/security/security_manager.h (virSecurityManagerPreFork):
Change signature.
* src/security/security_manager.c (virSecurityManagerPreFork):
Optionally call into driver, and allow returning failure.
* src/security/security_stack.c (virSecurityDriverStack):
Wrap the handler for the stack driver.
* src/qemu/qemu_process.c (qemuProcessStart): Adjust caller.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_process.c
src/security/security_driver.h
src/security/security_manager.c
src/security/security_manager.h
src/security/security_stack.c