[lxc-devel] [PATCH] chown_mapped_rootid: don't double-map root id
Stéphane Graber
stgraber at ubuntu.com
Tue Mar 4 16:10:56 UTC 2014
On Tue, Mar 04, 2014 at 09:58:30AM -0600, Serge Hallyn wrote:
> If the user maps container root to his host uid, chown_mapped_rootid
> tries to make the same mapping twice and gets -EINVAL.
>
> Reported-by: Andy Whitcroft <apw at canonical.com>
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/lxc/conf.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 2622371..1cb058d 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -3439,6 +3439,13 @@ int chown_mapped_root(char *path, struct lxc_conf *conf)
> }
> return 0;
> }
> +
> + if (rootid == geteuid()) {
> + // nothing to do
> + INFO("%s: container root is our uid; no need to chown" ,__func__);
> + return 0;
> + }
> +
> pid = fork();
> if (pid < 0) {
> SYSERROR("Failed forking");
> --
> 1.9.0
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140304/46ce9c94/attachment.pgp>
More information about the lxc-devel
mailing list