Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-14 Thread Serge E. Hallyn
Quoting Miklos Szeredi ([EMAIL PROTECTED]): > From: Miklos Szeredi <[EMAIL PROTECTED]> > > Allow bind mounts to unprivileged users if the following conditions are met: > > - mountpoint is not a symlink > - parent mount is owned by the user > - the number of user mounts is below the maximum

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-09 Thread Serge E. Hallyn
Quoting Miklos Szeredi ([EMAIL PROTECTED]): > From: Miklos Szeredi <[EMAIL PROTECTED]> > > Allow bind mounts to unprivileged users if the following conditions are met: > > - mountpoint is not a symlink > - parent mount is owned by the user > - the number of user mounts is below the maximum

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-09 Thread Miklos Szeredi
> case EMFILE: > error ("mount table full"); break; OK, we could go with EMFILE, but the message should be changed to something like "maximum unprivileged mount count exceeded". Miklos -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-09 Thread Karel Zak
On Wed, Jan 09, 2008 at 01:45:09PM +0100, Jan Engelhardt wrote: > > On Jan 8 2008 20:08, Miklos Szeredi wrote: > >> On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote: > >> > +static int reserve_user_mount(void) > >> > +{ > >> > + int err = 0; > >> > + > >> > + spin_lock(&vfsmount

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-09 Thread Jan Engelhardt
On Jan 8 2008 20:08, Miklos Szeredi wrote: >> On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote: >> > +static int reserve_user_mount(void) >> > +{ >> > + int err = 0; >> > + >> > + spin_lock(&vfsmount_lock); >> > + if (nr_user_mounts >= max_user_mounts && !capable(CAP_SYS_A

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Szabolcs Szakacsits
On Tue, 8 Jan 2008, Miklos Szeredi wrote: > > On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote: > > > +static int reserve_user_mount(void) > > > +{ > > > + int err = 0; > > > + > > > + spin_lock(&vfsmount_lock); > > > + if (nr_user_mounts >= max_user_mounts && !capable(CAP

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Miklos Szeredi
> > @@ -510,10 +533,16 @@ static struct vfsmount *clone_mnt(struct > > int flag) > > { > > struct super_block *sb = old->mnt_sb; > > - struct vfsmount *mnt = alloc_vfsmnt(old->mnt_devname); > > + struct vfsmount *mnt; > > > > + if

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Dave Hansen
On Tue, 2008-01-08 at 20:08 +0100, Miklos Szeredi wrote: > > The logic behind EPERM, is that this failure is only for unprivileged > callers. ENOMEM is too specifically about OOM. It could be changed > to ENOSPC, ENFILE, EMFILE, or it could remain EPERM. What do others > think? Since you're p

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Miklos Szeredi
> On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote: > > +static int reserve_user_mount(void) > > +{ > > + int err = 0; > > + > > + spin_lock(&vfsmount_lock); > > + if (nr_user_mounts >= max_user_mounts && !capable(CAP_SYS_ADMIN)) > > + err = -EPERM; > > +

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Dave Hansen
On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote: > @@ -510,10 +533,16 @@ static struct vfsmount *clone_mnt(struct > int flag) > { > struct super_block *sb = old->mnt_sb; > - struct vfsmount *mnt = alloc_vfsmnt(old->mnt_devname); > +

Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Dave Hansen
On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote: > +static int reserve_user_mount(void) > +{ > + int err = 0; > + > + spin_lock(&vfsmount_lock); > + if (nr_user_mounts >= max_user_mounts && !capable(CAP_SYS_ADMIN)) > + err = -EPERM; > + else > +

[patch 5/9] unprivileged mounts: allow unprivileged bind mounts

2008-01-08 Thread Miklos Szeredi
From: Miklos Szeredi <[EMAIL PROTECTED]> Allow bind mounts to unprivileged users if the following conditions are met: - mountpoint is not a symlink - parent mount is owned by the user - the number of user mounts is below the maximum Unprivileged mounts imply MS_SETUSER, and will also have