[libvirt] [PATCH 07/15] qemu: replace exec hook with virCommandSetUID/GID in storage_backend
Eric Blake
eblake at redhat.com
Fri Feb 8 17:49:24 UTC 2013
On 02/07/2013 02:37 PM, Laine Stump wrote:
> ---
> src/storage/storage_backend.c | 28 ++++++----------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
>
> @@ -576,7 +558,9 @@ static int virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
> }
> }
>
> - data.skip = true;
> + /* don't change uid/gid if we retry */
> + virCommandSetUID(cmd, 0);
> + virCommandSetGID(cmd, 0);
Hmm, so you are reusing an existing virCommand, but want to change it to
no longer attempt uid/gid change (that is, inherit the uid/gid of the
current libvirtd). If you refactor things in earlier patches to use -1
as the no-op, and allow an attempt to change to id 0, then this needs
alteration to -1.
And per the man page of setfsuid, there really are reasons why one would
attempt to change uid to 0, even when already executing as uid 0 - it
forces Linux to resync the fsuid back to 0. True, not much code plays
with fsuid, and it is rare to have a program where fsuid differs from
uid, but I'd rather our wrapper lets us expose full kernel/glibc rules
on id setting, than to accidentally short-circuit away something that
has important side-effects in odd corner cases.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130208/c9946625/attachment-0001.sig>
More information about the libvir-list
mailing list