Message ID | 61a37f0b159dd56825696d8d3beb8eaffdf1f72f.1512041070.git.dongsu@kinvolk.io (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Dec 22, 2017 at 03:32:31PM +0100, Dongsu Park wrote: > From: Seth Forshee <seth.forshee@canonical.com> > > The user in control of a super block should be allowed to freeze > and thaw it. Relax the restrictions on the FIFREEZE and FITHAW > ioctls to require CAP_SYS_ADMIN in s_user_ns. > > Cc: linux-fsdevel@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: Alexander Viro <viro@zeniv.linux.org.uk> > Signed-off-by: Seth Forshee <seth.forshee@canonical.com> > Signed-off-by: Dongsu Park <dongsu@kinvolk.io> Reviewed-by: Serge Hallyn <serge@hallyn.com> > --- > fs/ioctl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ioctl.c b/fs/ioctl.c > index 5ace7efb..8c628a8d 100644 > --- a/fs/ioctl.c > +++ b/fs/ioctl.c > @@ -549,7 +549,7 @@ static int ioctl_fsfreeze(struct file *filp) > { > struct super_block *sb = file_inode(filp)->i_sb; > > - if (!capable(CAP_SYS_ADMIN)) > + if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) > return -EPERM; > > /* If filesystem doesn't support freeze feature, return. */ > @@ -566,7 +566,7 @@ static int ioctl_fsthaw(struct file *filp) > { > struct super_block *sb = file_inode(filp)->i_sb; > > - if (!capable(CAP_SYS_ADMIN)) > + if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) > return -EPERM; > > /* Thaw */ > -- > 2.13.6 > > _______________________________________________ > Containers mailing list > Containers@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/containers
On Fri, Dec 22, 2017 at 3:32 PM, Dongsu Park <dongsu@kinvolk.io> wrote: > From: Seth Forshee <seth.forshee@canonical.com> > > The user in control of a super block should be allowed to freeze > and thaw it. Relax the restrictions on the FIFREEZE and FITHAW > ioctls to require CAP_SYS_ADMIN in s_user_ns. Why is this required for unprivileged fuse? Fuse doesn't support freeze, so this seems to make no sense in the context of this patchset. Thanks, Miklos
Miklos Szeredi <mszeredi@redhat.com> writes: > On Fri, Dec 22, 2017 at 3:32 PM, Dongsu Park <dongsu@kinvolk.io> wrote: >> From: Seth Forshee <seth.forshee@canonical.com> >> >> The user in control of a super block should be allowed to freeze >> and thaw it. Relax the restrictions on the FIFREEZE and FITHAW >> ioctls to require CAP_SYS_ADMIN in s_user_ns. > > Why is this required for unprivileged fuse? > > Fuse doesn't support freeze, so this seems to make no sense in the > context of this patchset. This isn't required to support fuse. It is a relaxation in permissions so it isn't strictly necessary for anything. Until just recently Seth and I work working through the vfs looking at what we need in general for unprivileged mounts. With fuse as our focus but we were not limiting ourselves to fuse. I have been putting off relaxation of permissions like this because they are not necessary for safety. But in general they do make sense. In practice I think all we need to worry about for fuse is the last 4 patches. Eric
diff --git a/fs/ioctl.c b/fs/ioctl.c index 5ace7efb..8c628a8d 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -549,7 +549,7 @@ static int ioctl_fsfreeze(struct file *filp) { struct super_block *sb = file_inode(filp)->i_sb; - if (!capable(CAP_SYS_ADMIN)) + if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) return -EPERM; /* If filesystem doesn't support freeze feature, return. */ @@ -566,7 +566,7 @@ static int ioctl_fsthaw(struct file *filp) { struct super_block *sb = file_inode(filp)->i_sb; - if (!capable(CAP_SYS_ADMIN)) + if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) return -EPERM; /* Thaw */