linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: CGEL <cgel.zte@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: christian.brauner@ubuntu.com, jamorris@linux.microsoft.com,
	gladkov.alexey@gmail.com, yang.yang29@zte.com.cn, tj@kernel.org,
	paul.gortmaker@windriver.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] proc: prevent mount proc on same mountpoint in one pid namespace
Date: Sun, 22 Aug 2021 06:06:30 -0700	[thread overview]
Message-ID: <20210822130630.GA39585@www> (raw)
In-Reply-To: <YSEJSKgwNKqGupt/@zeniv-ca.linux.org.uk>

On Sat, Aug 21, 2021 at 02:10:16PM +0000, Al Viro wrote:
> On Sat, Aug 21, 2021 at 01:31:05AM -0700, cgel.zte@gmail.com wrote:
> > From: Yang Yang <yang.yang29@zte.com.cn>
> > 
> > Patch "proc: allow to mount many instances of proc in one pid namespace"
> > aims to mount many instances of proc on different mountpoint, see
> > tools/testing/selftests/proc/proc-multiple-procfs.c.
> > 
> > But there is a side-effects, user can mount many instances of proc on
> > the same mountpoint in one pid namespace, which is not allowed before.
> > This duplicate mount makes no sense but wastes memory and CPU, and user
> > may be confused why kernel allows it.
> > 
> > The logic of this patch is: when try to mount proc on /mnt, check if
> > there is a proc instance mount on /mnt in the same pid namespace. If
> > answer is yes, return -EBUSY.
> > 
> > Since this check can't be done in proc_get_tree(), which call
> > get_tree_nodev() and will create new super_block unconditionally.
> > And other nodev fs may faces the same case, so add a new hook in
> > fs_context_operations.
> 
> NAK.  As attack prevention it's worthless (you can just bind-mount
> a tmpfs directory between them).  Besides, filesystem does *not*
> get to decide where it would be mounted.  Especially since it couldn't
> rely upon that, anyway, what with mount --bind possible *after* it had
> been initially mounted.

Thanks for your relpy! No doubt anymore.

      reply	other threads:[~2021-08-22 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21  8:31 [PATCH] proc: prevent mount proc on same mountpoint in one pid namespace cgel.zte
2021-08-21  8:58 ` Alexey Gladkov
2021-08-21 14:10 ` Al Viro
2021-08-22 13:06   ` CGEL [this message]

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=20210822130630.GA39585@www \
    --to=cgel.zte@gmail.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=gladkov.alexey@gmail.com \
    --cc=jamorris@linux.microsoft.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yang.yang29@zte.com.cn \
    --cc=zealci@zte.com.cn \
    /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).