]> git.ipfire.org Git - thirdparty/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>
Mon, 22 Jul 2013 17:41:50 +0000 (11:41 -0600)
commit689d014686939be3f96e4500b46b904a5ccc276e
treede74159bd785392f80d58ce0a74ac48a4a9ca7f2
parent7d24a0a226c8936e75b18b58191d6dacb3bc0aba
security: framework for driver PreFork handler

https://bugzilla.redhat.com/show_bug.cgi?id=964358

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>
(cherry picked from commit fdb3bde31ccf8ff172abf00ef5aa974b87af2794)
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