Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757328AbdLWDjW (ORCPT ); Fri, 22 Dec 2017 22:39:22 -0500 Received: from h2.hallyn.com ([78.46.35.8]:54174 "EHLO h2.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757161AbdLWDjU (ORCPT ); Fri, 22 Dec 2017 22:39:20 -0500 Date: Fri, 22 Dec 2017 21:39:18 -0600 From: "Serge E. Hallyn" To: Dongsu Park Cc: linux-kernel@vger.kernel.org, Miklos Szeredi , containers@lists.linux-foundation.org, Seth Forshee , Alban Crequy , "Eric W . Biederman" , Sargun Dhillon , linux-fsdevel@vger.kernel.org, Alexander Viro Subject: Re: [PATCH 07/11] fs: Allow CAP_SYS_ADMIN in s_user_ns to freeze and thaw filesystems Message-ID: <20171223033918.GG6837@mail.hallyn.com> References: <61a37f0b159dd56825696d8d3beb8eaffdf1f72f.1512041070.git.dongsu@kinvolk.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <61a37f0b159dd56825696d8d3beb8eaffdf1f72f.1512041070.git.dongsu@kinvolk.io> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1513 Lines: 48 On Fri, Dec 22, 2017 at 03:32:31PM +0100, Dongsu Park wrote: > From: Seth Forshee > > 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 > Signed-off-by: Seth Forshee > Signed-off-by: Dongsu Park Reviewed-by: Serge Hallyn > --- > 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