Linux Container Development
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Alin Dobre <alin.dobre-1hSFou9RDDldEee+Cai+ZQ@public.gmane.org>
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Eric Van Hensbergen
	<ericvh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: User namespace over 9p
Date: Tue, 27 May 2014 03:39:54 -0700	[thread overview]
Message-ID: <87fvjvpksl.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <53846804.6080408-1hSFou9RDDldEee+Cai+ZQ@public.gmane.org> (Alin Dobre's message of "Tue, 27 May 2014 11:25:08 +0100")

Alin Dobre <alin.dobre-1hSFou9RDDldEee+Cai+ZQ@public.gmane.org> writes:

> Hello,
>
> Continuing the struggle to run containers over the 9p filesystem I am
> now running into another issue.
>
> A simple container with user namespace mapping UID -2 (4294967294) to
> root can run a container image found in /tmp/src without any problems.
> When I export that /tmp/src path via 9p and mount it in /tmp/dst,
> running the same container over /tmp/dst fails to allow chown (and
> probably chmod) system calls to be successful. This happens because 9p
> considers that the UID which runs the system calls is actually -2, but
> it's actually 0, because the lchown system call is run inside the
> namespace, not outside it. So, 9p should consider that the UID which
> does the system call is root.

No the UID is actually -2. (-2 is a little dangerous to use because
sometimes -2 is used for the nobody user and similar special purposes).

There is some minor relaxation of the rules in the vfs to allow changing
to a uid you have mapped in your user namespace.  Which is why chown
works at all.

> Do I understand this correctly as a problem, or does it work as
> intended? If latter, do you have any insights on how to achieve running
> containers in this scenario?

If the permission check is made on the kernel with user namespaces we
can reasonablly make it work.  Otherwise we can not.  That is a danger
of using remote filesystems they can sometimes have weird arbitrary
rules you were not expected.

Eric

       reply	other threads:[~2014-05-27 10:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53846804.6080408@elastichosts.com>
     [not found] ` <53846804.6080408-1hSFou9RDDldEee+Cai+ZQ@public.gmane.org>
2014-05-27 10:39   ` Eric W. Biederman [this message]
     [not found]     ` <87fvjvpksl.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-05-27 10:51       ` User namespace over 9p Alin Dobre
2014-06-10 12:58       ` Alin Dobre
     [not found]         ` <539700EC.5010407-1hSFou9RDDldEee+Cai+ZQ@public.gmane.org>
2014-06-11 23:14           ` Eric W. Biederman
2014-05-27 10:25 Alin Dobre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvjvpksl.fsf@x220.int.ebiederm.org \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=alin.dobre-1hSFou9RDDldEee+Cai+ZQ@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=ericvh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox