LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Aleksa Sarai <asarai@suse.de>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alban Crequy <alban.crequy@gmail.com>,
Alban Crequy <alban@kinvolk.io>, Dongsu Park <dongsu@kinvolk.io>,
Iago Lopez Galeiras <iago@kinvolk.io>,
Stephen J Day <stephen.day@docker.com>,
Michael Crosby <crosbymichael@gmail.com>,
Jess Frazelle <acidburn@microsoft.com>,
Akihiro Suda <suda.akihiro@lab.ntt.co.jp>,
Daniel J Walsh <dwalsh@redhat.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
containers@lists.linux-foundation.org
Subject: Re: [PATCH] [RFC][WIP] namespace.c: Allow some unprivileged proc mounts when not fully visible
Date: Thu, 5 Apr 2018 01:34:22 +1000 [thread overview]
Message-ID: <20180404153422.mea4nup3ldc2q2qt@gordon> (raw)
In-Reply-To: <87tvsrjai0.fsf@xmission.com>
[-- Attachment #1: Type: text/plain, Size: 2700 bytes --]
On 2018-04-04, Eric W. Biederman <ebiederm@xmission.com> wrote:
> > The following commands show my problem:
> >
> > $ sudo docker run -ti --rm --cap-add=SYS_ADMIN busybox sh -c 'unshare -U -r -p -m -f mount -t proc proc /home && echo ok'
> > mount: permission denied (are you root?)
> >
> > $ sudo docker run -ti --rm --cap-add=SYS_ADMIN busybox sh -c 'mkdir -p /unmasked-proc && mount -t proc proc /unmasked-proc && unshare -U -r -p -m -f mount -t proc proc /home && echo ok'
> > ok
>
> Actually this does not show your problem because it does not reveal why
> you need to mount proc.
>
> That is a ``Doctor it hurts when I do this'' example where the Doctor
> will reasonably tell you ``Don't do that then''.
The context is that people want to run unprivileged runc inside a Docker
container, and mounting proc is part of setting up a container. But
Docker (and runc) have masks for /proc to stop containers from being
able to touch things like /proc/scsi and so on. The other possibility is
to give people an escape-hatch when setting up a container which
basically says "make this container slightly less secure so that I can
run containers inside it".
However I share your concern about the layer mixing with inheriting the
masks for the new procfs mount (what if you have a mount over a
particular process, now the mask is masking something completely
different, and a bunch of other possible problems).
> > For my use case, I will need to support at least the following entries:
> >
> > $ sudo docker run -ti --rm busybox sh -c 'mount|grep /proc/'
> > proc on /proc/asound type proc (ro,nosuid,nodev,noexec,relatime)
> > proc on /proc/bus type proc (ro,nosuid,nodev,noexec,relatime)
> > proc on /proc/fs type proc (ro,nosuid,nodev,noexec,relatime)
> > proc on /proc/irq type proc (ro,nosuid,nodev,noexec,relatime)
> > proc on /proc/sys type proc (ro,nosuid,nodev,noexec,relatime)
> > proc on /proc/sysrq-trigger type proc (ro,nosuid,nodev,noexec,relatime)
> > tmpfs on /proc/kcore type tmpfs (rw,context="...",nosuid,mode=755)
> > tmpfs on /proc/latency_stats type tmpfs (rw,context="...",nosuid,mode=755)
> > tmpfs on /proc/timer_list type tmpfs (rw,context="...",nosuid,mode=755)
> > tmpfs on /proc/sched_debug type tmpfs (rw,context="...",nosuid,mode=755)
> > tmpfs on /proc/scsi type tmpfs (ro,seclabel,relatime)
>
> It looks like a cruft free cousin of proc that is just processes would
> be applicable to your usecase.
I think a procfs that only has processes would be a massive improvement
for a bunch of other reasons too. :D
--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-04-04 15:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 11:53 Alban Crequy
2018-04-04 14:45 ` Eric W. Biederman
2018-04-04 15:34 ` Aleksa Sarai [this message]
2018-04-04 18:42 ` Serge E. Hallyn
2018-04-04 22:02 ` Eric W. Biederman
2018-04-05 14:19 ` Christian Brauner
2018-04-13 22:41 ` Djalal Harouni
2018-04-16 14:16 ` Alexey Gladkov
2018-04-04 17:45 Alexey Dobriyan
2018-04-04 17:49 Alexey Dobriyan
2018-04-04 23:59 ` Eric W. Biederman
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=20180404153422.mea4nup3ldc2q2qt@gordon \
--to=asarai@suse.de \
--cc=acidburn@microsoft.com \
--cc=alban.crequy@gmail.com \
--cc=alban@kinvolk.io \
--cc=containers@lists.linux-foundation.org \
--cc=crosbymichael@gmail.com \
--cc=dongsu@kinvolk.io \
--cc=dwalsh@redhat.com \
--cc=ebiederm@xmission.com \
--cc=iago@kinvolk.io \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stephen.day@docker.com \
--cc=suda.akihiro@lab.ntt.co.jp \
--cc=viro@zeniv.linux.org.uk \
--subject='Re: [PATCH] [RFC][WIP] namespace.c: Allow some unprivileged proc mounts when not fully visible' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).