mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
virSetUIDGID: Don't leak supplementary groups
The LXC driver uses virSetUIDGID() to become UID/GID 0. It passes an empty groups list to virSetUIDGID() to get rid of all supplementary groups from the host side. But virSetUIDGID() calls setgroups() only if the supplied list is larger than 0. This leads to a container root with unrelated supplementary groups. In most cases this issue is unoticed as libvirtd runs as UID/GID 0 without any supplementary groups. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
370707a7a9
commit
867f34a683
@ -1103,7 +1103,7 @@ virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
# if HAVE_SETGROUPS
|
||||
if (ngroups && setgroups(ngroups, groups) < 0) {
|
||||
if (gid != (gid_t)-1 && setgroups(ngroups, groups) < 0) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("cannot set supplemental groups"));
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user