]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: let virCommand set child process security labels/uid/gid
authorLaine Stump <laine@laine.org>
Fri, 1 Feb 2013 20:20:22 +0000 (15:20 -0500)
committerLaine Stump <laine@laine.org>
Wed, 13 Feb 2013 21:11:16 +0000 (16:11 -0500)
commit0345c7281b0da33245884ce568dca0b3483033a5
tree53a9303c485f7394e2b9780ef42b7bdc5e32dfcc
parent7bf1aa0b9b60c3e83c2a89e11010350551218593
qemu: let virCommand set child process security labels/uid/gid

The qemu driver had been calling virSecurityManagerSetProcessLabel()
from a "pre-exec hook" function that is run after the child is forked,
but before exec'ing qemu. This is problematic because the uid and gid
of the child are set by the security driver, but capabilities are
dropped by virCommand - such separation doesn't work; the two
operations must be done together or the capabilities do not transfer
properly to the child process.

This patch switches to using virSecurityManagerSetChildProcessLabel(),
which is called prior to virCommandRun() (rather than being called
*during* virCommandrun() by the hook function), and doesn't set the
UID/GID/security label directly, but instead merely informs virCommand
what it should set them all to when the time is appropriate.

This lets virCommand choose to do the uid/gid and caps dropping all at
the same time if it wants (it does *want* to, but isn't doing so yet;
that's for an upcoming patch).
src/qemu/qemu_process.c