Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598531

Re: [RFC] Add option to mount only a pids subset

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [RFC] Add option to mount only a pids subset
Date 2017-03-12 03:20 +0100
Message-ID <tk1h0-3eX-11@gated-at.bofh.it> (permalink)
References <tdk53-3Wc-5@gated-at.bofh.it> <tiaop-73N-1@gated-at.bofh.it> <tk0XE-2T5-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Mar 12, 2017 at 01:54:38AM +0000, Al Viro wrote:
> On Tue, Mar 07, 2017 at 12:05:16AM +0100, Alexey Gladkov wrote:
> 
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 83de8b6..5bd1b84 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -1759,6 +1759,8 @@ struct super_operations {
> >  	int (*thaw_super) (struct super_block *);
> >  	int (*unfreeze_fs) (struct super_block *);
> >  	int (*statfs) (struct dentry *, struct kstatfs *);
> > +	int (*getattr_fs) (struct vfsmount *, struct dentry *, struct kstat *);
> > +	int (*mount_fs) (struct vfsmount *, int *, char *);
> >  	int (*remount_fs) (struct super_block *, int *, char *);
> >  	void (*umount_begin) (struct super_block *);
> >  
> > diff --git a/include/linux/mount.h b/include/linux/mount.h
> > index 1172cce..4bd364e 100644
> > --- a/include/linux/mount.h
> > +++ b/include/linux/mount.h
> > @@ -67,6 +67,7 @@ struct vfsmount {
> >  	struct dentry *mnt_root;	/* root of the mounted tree */
> >  	struct super_block *mnt_sb;	/* pointer to superblock */
> >  	int mnt_flags;
> > +	void *fs_data;			/* fs-specific data */
> 
> 	No.  This is really asking for trouble - you *can't* hang
> fs-specific data structures off vfsmount.  Lifetimes make no
> sense whatsoever.
>
> 	BTW, your patch leaks supreblock reference on failure, and
> is kludgy as hell wrt to what it's doing in procfs itself, but
> that's secondary - the quoted part is enough for a hard NAK on
> architectural grounds.  Don't go there.

PS: AFAICS, simple mount --bind of your pid-only mount will suddenly
expose the full thing.  And as for the lifetimes making no sense...
note that you are simply not freeing these structures of yours.
Try to handle that and you'll get a serious PITA all over the
place.

What are you trying to achieve, anyway?  Why not add a second vfsmount
pointer per pid_namespace and make it initialized on demand, at the
first attempt of no-pid mount?  Just have a separate no-pid instance
created for those namespaces where it had been asked for, with
separate superblock and dentry tree not containing anything other
that pid-only parts + self + thread-self...

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] Add option to mount only a pids subset Alexey Gladkov <gladkov.alexey@gmail.com> - 2017-03-07 00:40 +0100
  Re: [RFC] Add option to mount only a pids subset Andy Lutomirski <luto@amacapital.net> - 2017-03-07 17:30 +0100
    Re: [RFC] Add option to mount only a pids subset Djalal Harouni <tixxdz@gmail.com> - 2017-03-09 12:30 +0100
      Re: [RFC] Add option to mount only a pids subset ebiederm@xmission.com (Eric W. Biederman) - 2017-03-09 22:00 +0100
      Re: [RFC] Add option to mount only a pids subset Alexey Gladkov <gladkov.alexey@gmail.com> - 2017-03-11 22:50 +0100
    Re: [RFC] Add option to mount only a pids subset Alexey Gladkov <gladkov.alexey@gmail.com> - 2017-03-11 01:00 +0100
  Re: [RFC] Add option to mount only a pids subset Oleg Nesterov <oleg@redhat.com> - 2017-03-07 19:00 +0100
    Re: [RFC] Add option to mount only a pids subset Alexey Gladkov <gladkov.alexey@gmail.com> - 2017-03-11 00:40 +0100
  Re: [RFC] Add option to mount only a pids subset Al Viro <viro@ZenIV.linux.org.uk> - 2017-03-12 03:00 +0100
    Re: [RFC] Add option to mount only a pids subset Al Viro <viro@ZenIV.linux.org.uk> - 2017-03-12 03:20 +0100
      Re: [RFC] Add option to mount only a pids subset Andy Lutomirski <luto@amacapital.net> - 2017-03-13 04:30 +0100
        Re: [RFC] Add option to mount only a pids subset Al Viro <viro@ZenIV.linux.org.uk> - 2017-03-13 14:30 +0100
          Re: [RFC] Add option to mount only a pids subset Andy Lutomirski <luto@kernel.org> - 2017-03-13 16:30 +0100

csiph-web