]> git.ipfire.org Git - thirdparty/lxc.git/commit
chown_mapped_root: don't try chgrp if we don't own the file
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 3 Jul 2014 18:57:57 +0000 (13:57 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 3 Jul 2014 19:54:06 +0000 (15:54 -0400)
commita8fe4754c9da6cce95aeb042f6fc015cd6e5569b
tree4faaca86ce35488d78784664066d0119d69f9083
parent82866e3c00f6ad5271378cd9102afd12c843e588
chown_mapped_root: don't try chgrp if we don't own the file

New kernels require that to have privilege over a file, your
userns must have the old and new groups mapped into your userns.
So if a file is owned by our uid but another groupid, then we
have to chgrp the file to our primary group before we can try
(in a new user namespace) to chgrp the file to a group id in the
namespace.

But in some cases (when cloning) the file may already be mapped
into the container.  Now we cannot chgrp the file to our own
primary group - and we don't have to.

So detect that case.  Only try to chgrp the file to our primary
group if the file is owned by our euid (i.e. not by the container)
and the owning group is not already mapped into the container by
default.

With this patch, I'm again able to both create and clone containers
with no errors again.

Reported-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c