From: Alexey Gladkov <gladkov.alexey@gmail.com>
To: Djalal Harouni <tixxdz@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Vasiliy Kulikov <segoon@openwall.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Oleg Nesterov <oleg@redhat.com>,
Pavel Emelyanov <xemul@parallels.com>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
"Dmitry V. Levin" <ldv@altlinux.org>
Subject: Re: [RFC] Add option to mount only a pids subset
Date: Thu, 23 Mar 2017 23:07:12 +0100 [thread overview]
Message-ID: <20170323220712.GH4554@comp-core-i7-2640m-0182e6> (raw)
In-Reply-To: <CAEiveUcj6d7mJKRHJs73T7Z1-qRgqE+xsMc1NDivFKeJhjMeJQ@mail.gmail.com>
On Thu, Mar 23, 2017 at 05:06:28PM +0100, Djalal Harouni wrote:
> Hi Alexey,
>
> On Mon, Mar 20, 2017 at 1:58 PM, Alexey Gladkov
> <gladkov.alexey@gmail.com> wrote:
> >
> >
> > Al Viro, this patch looks better ?
> >
> > == Overview ==
> >
> > Some of the container virtualization systems are mounted /proc inside
> > the container. This is done in most cases to operate with information
> > about the processes. Knowing that /proc filesystem is not fully
> > virtualized they are mounted on top of dangerous places empty files or
> > directories (for exmaple /proc/sys, /proc/kcore, /sys/firmware, etc.).
> >
> > The structure of this filesystem is dynamic and any module can create a
> > new object which will not necessarily be virtualized. There are
> > proprietary modules that aren't in the mainline whose work we can not
> > verify.
> >
> > This opens up a potential threat to the system. The developers of the
> > virtualization system can't predict all dangerous places in /proc by
> > definition.
> >
> > A more effective solution would be to mount into the container only what
> > is necessary and ignore the rest.
> >
> > Right now there is the opportunity to pass in the container any port of
> > the /proc filesystem using mount --bind expect the pids.
> >
> > This patch allows to mount only the part of /proc related to pids without
> > rest objects. Since this is an option for /proc, flags applied to /proc
> > have an effect on this subset of filesystem.
>
> I just sent a patch that also has to deal with proc hidepid here:
> https://lkml.org/lkml/2017/3/23/505
I completely agree with you that it looks wrong when options of one
mountpoint affect the others mountpoints.
> I'm not sure if that's the right approach, it is still buggy, however
> seems that your patch also stores the mount option inside the
> pid_namespace which may get propagated to all mounts inside same pidns
> ?
I don't store 'pidonly' option in my current patch. I mean in:
https://lkml.org/lkml/2017/3/20/363
I parse options twice at first mount of procfs. It happens before
the mounting /proc in userspace.
I know it's bad, but I couldn't find place to store this option.
> I didn't have enough time but maybe if they are related we can work it
> out together ?
I don't have enough experience in kenrel hacking, but I would happily do
my best :)
I also tring to mention it in every patch, as my changes almost completely
useless without the ability to use the overlayfs.
Now if you remove the restriction:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/inode.c#n497
and mount procfs as lowerdir in overlayfs then you get NULL pointer
dereference at:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/namei.c#n891
I got it when I tried to do `ls -la /overlay/proc/self/`.
--
Rgrds, legion
next prev parent reply other threads:[~2017-03-23 22:07 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-18 22:53 [PATCH] Add pidfs filesystem Alexey Gladkov
2017-02-18 23:34 ` kbuild test robot
2017-02-18 23:34 ` kbuild test robot
2017-02-20 4:05 ` Eric W. Biederman
2017-02-20 10:36 ` Alexey Gladkov
2017-02-22 20:11 ` Richard Weinberger
2017-02-21 14:57 ` Oleg Nesterov
2017-02-22 7:40 ` Pavel Emelyanov
2017-02-22 12:04 ` Alexey Gladkov
2017-02-22 13:08 ` Pavel Emelyanov
2017-02-22 11:53 ` Alexey Gladkov
2017-02-22 15:37 ` Dmitry V. Levin
2017-02-22 17:48 ` Oleg Nesterov
2017-02-22 19:56 ` Alexey Gladkov
2017-03-06 23:05 ` [RFC] Add option to mount only a pids subset Alexey Gladkov
2017-03-07 16:24 ` Andy Lutomirski
2017-03-09 11:26 ` Djalal Harouni
2017-03-09 20:52 ` Eric W. Biederman
2017-03-11 21:51 ` Alexey Gladkov
2017-03-11 0:05 ` Alexey Gladkov
2017-03-07 17:49 ` Oleg Nesterov
2017-03-10 23:46 ` Alexey Gladkov
2017-03-12 1:54 ` Al Viro
2017-03-12 2:13 ` Al Viro
2017-03-13 3:19 ` Andy Lutomirski
2017-03-13 13:27 ` Al Viro
2017-03-13 15:24 ` Andy Lutomirski
2017-03-23 15:59 ` [PATCH] proc: allow to change proc mount options per mount Djalal Harouni
2017-03-20 12:58 ` [RFC] Add option to mount only a pids subset Alexey Gladkov
2017-03-23 16:05 ` Oleg Nesterov
2017-03-23 22:57 ` Alexey Gladkov
2017-03-23 16:06 ` Djalal Harouni
2017-03-23 22:07 ` Alexey Gladkov [this message]
2017-03-26 7:03 ` Djalal Harouni
2017-03-30 21:45 ` Alexey Gladkov
2017-02-27 18:56 ` [PATCH] Add pidfs filesystem Michael Kerrisk
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=20170323220712.GH4554@comp-core-i7-2640m-0182e6 \
--to=gladkov.alexey@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=ebiederm@xmission.com \
--cc=kirill@shutemov.name \
--cc=ldv@altlinux.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=segoon@openwall.com \
--cc=tixxdz@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=xemul@parallels.com \
/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;
as well as URLs for NNTP newsgroup(s).