From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: Re: [PATCH v23 14/22] richacl: Update the file masks in chmod() Date: Tue, 12 Jul 2016 07:36:56 -0400 Message-ID: <1468323416.7798.7.camel@redhat.com> References: <1467294433-3222-1-git-send-email-agruenba@redhat.com> <1467294433-3222-15-git-send-email-agruenba@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Christoph Hellwig , Theodore Ts'o , Andreas Dilger , "J. Bruce Fields" , Trond Myklebust , Anna Schumaker , Dave Chinner , linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, xfs-VZNHf3L845pBDgjK7y7TUQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andreas Gruenbacher , Alexander Viro Return-path: In-Reply-To: <1467294433-3222-15-git-send-email-agruenba-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Thu, 2016-06-30 at 15:47 +0200, Andreas Gruenbacher wrote: > Doing a chmod() sets the file mode, which includes the file permissio= n > bits.=C2=A0=C2=A0When a file has a richacl, the permissions that the = richacl > grants need to be limited to what the new file permission bits allow. >=20 > This is done by setting the file masks in the richacl to what the fil= e > permission bits map to.=C2=A0=C2=A0The richacl access check algorithm= takes the > file masks into account, which ensures that the richacl cannot grant = too > many permissions. >=20 > It is possible to explicitly add permissions to the file masks which = go > beyond what the file permission bits can grant (like the > RICHACE_WRITE_ACL permission).=C2=A0=C2=A0The POSIX.1 standard calls = this an > alternate file access control mechanism.=C2=A0=C2=A0A subsequent chmo= d() would > ensure that those permissions are disabled again. >=20 > Signed-off-by: Andreas Gruenbacher > Reviewed-by: J. Bruce Fields > --- > =C2=A0fs/richacl.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0| 71 +++++++++++++++++++++++++++++++++++++++++++++= ++++ > =C2=A0include/linux/richacl.h |=C2=A0=C2=A01 + > =C2=A02 files changed, 72 insertions(+) >=20 > diff --git a/fs/richacl.c b/fs/richacl.c > index b2a03c1..ba110a6 100644 > --- a/fs/richacl.c > +++ b/fs/richacl.c > @@ -547,3 +547,74 @@ out: > =C2=A0 return denied ? -EACCES : 0; > =C2=A0} > =C2=A0EXPORT_SYMBOL_GPL(richacl_permission); > + > +/** > + * __richacl_chmod=C2=A0=C2=A0-=C2=A0=C2=A0update the file masks to = reflect the new mode > + * @acl: access control list > + * @mode: new file permission bits including the file type > + * > + * Return a copy of @acl where the file masks have been replaced by = the file > + * masks corresponding to the file permission bits in @mode, or retu= rns @acl > + * itself if the file masks are already up to date.=C2=A0=C2=A0Takes= over a reference > + * to @acl. > + */ > +static struct richacl * > +__richacl_chmod(struct richacl *acl, umode_t mode) > +{ > + unsigned int x =3D S_ISDIR(mode) ? 0 : RICHACE_DELETE_CHILD; > + unsigned int owner_mask, group_mask, other_mask; > + struct richacl *clone; > + > + owner_mask =3D richacl_mode_to_mask(mode >> 6) & ~x; > + group_mask =3D richacl_mode_to_mask(mode >> 3) & ~x; > + other_mask =3D richacl_mode_to_mask(mode)=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0& ~x; > + > + if (acl->a_owner_mask =3D=3D owner_mask && > + =C2=A0=C2=A0=C2=A0=C2=A0acl->a_group_mask =3D=3D group_mask && > + =C2=A0=C2=A0=C2=A0=C2=A0acl->a_other_mask =3D=3D other_mask && > + =C2=A0=C2=A0=C2=A0=C2=A0(acl->a_flags & RICHACL_MASKED) && > + =C2=A0=C2=A0=C2=A0=C2=A0(acl->a_flags & RICHACL_WRITE_THROUGH)) > + return acl; > + > + clone =3D richacl_clone(acl, GFP_KERNEL); > + richacl_put(acl); > + if (!clone) > + return ERR_PTR(-ENOMEM); > + > + clone->a_flags |=3D (RICHACL_WRITE_THROUGH | RICHACL_MASKED); > + clone->a_owner_mask =3D owner_mask; > + clone->a_group_mask =3D group_mask; > + clone->a_other_mask =3D other_mask; > + > + return clone; > +} > + > +/** > + * richacl_chmod=C2=A0=C2=A0-=C2=A0=C2=A0filesystem chmod helper > + * @inode: inode whose file permission bits to change > + * @mode: new file permission bits including the file type > + * > + * Helper for filesystems to use to perform a chmod on the richacl o= f an inode. > + */ > +int > +richacl_chmod(struct inode *inode, umode_t mode) > +{ > + struct richacl *acl; > + int retval; > + > + if (S_ISLNK(mode)) > + return -EOPNOTSUPP; > + if (!inode->i_op->set_richacl) > + return -EOPNOTSUPP; > + acl =3D get_richacl(inode); > + if (IS_ERR_OR_NULL(acl)) > + return PTR_ERR(acl); > + acl =3D __richacl_chmod(acl, mode); > + if (IS_ERR(acl)) > + return PTR_ERR(acl); > + retval =3D inode->i_op->set_richacl(inode, acl); > + richacl_put(acl); > + > + return retval; > +} > +EXPORT_SYMBOL(richacl_chmod); > diff --git a/include/linux/richacl.h b/include/linux/richacl.h > index 3e05c94..db82fab 100644 > --- a/include/linux/richacl.h > +++ b/include/linux/richacl.h > @@ -190,5 +190,6 @@ extern unsigned int richacl_mode_to_mask(umode_t)= ; > =C2=A0extern unsigned int richacl_want_to_mask(unsigned int); > =C2=A0extern void richacl_compute_max_masks(struct richacl *); > =C2=A0extern int richacl_permission(struct inode *, const struct rich= acl *, int); > +extern int richacl_chmod(struct inode *, umode_t); > =C2=A0 > =C2=A0#endif /* __RICHACL_H */ Acked-by: Jeff Layton From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932992AbcGLLhF (ORCPT ); Tue, 12 Jul 2016 07:37:05 -0400 Received: from mail-qt0-f176.google.com ([209.85.216.176]:34603 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753563AbcGLLhA (ORCPT ); Tue, 12 Jul 2016 07:37:00 -0400 Message-ID: <1468323416.7798.7.camel@redhat.com> Subject: Re: [PATCH v23 14/22] richacl: Update the file masks in chmod() From: Jeff Layton To: Andreas Gruenbacher , Alexander Viro Cc: Christoph Hellwig , "Theodore Ts'o" , Andreas Dilger , "J. Bruce Fields" , Trond Myklebust , Anna Schumaker , Dave Chinner , linux-ext4@vger.kernel.org, xfs@oss.sgi.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-api@vger.kernel.org Date: Tue, 12 Jul 2016 07:36:56 -0400 In-Reply-To: <1467294433-3222-15-git-send-email-agruenba@redhat.com> References: <1467294433-3222-1-git-send-email-agruenba@redhat.com> <1467294433-3222-15-git-send-email-agruenba@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.3 (3.20.3-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-06-30 at 15:47 +0200, Andreas Gruenbacher wrote: > Doing a chmod() sets the file mode, which includes the file permission > bits.  When a file has a richacl, the permissions that the richacl > grants need to be limited to what the new file permission bits allow. > > This is done by setting the file masks in the richacl to what the file > permission bits map to.  The richacl access check algorithm takes the > file masks into account, which ensures that the richacl cannot grant too > many permissions. > > It is possible to explicitly add permissions to the file masks which go > beyond what the file permission bits can grant (like the > RICHACE_WRITE_ACL permission).  The POSIX.1 standard calls this an > alternate file access control mechanism.  A subsequent chmod() would > ensure that those permissions are disabled again. > > Signed-off-by: Andreas Gruenbacher > Reviewed-by: J. Bruce Fields > --- >  fs/richacl.c            | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ >  include/linux/richacl.h |  1 + >  2 files changed, 72 insertions(+) > > diff --git a/fs/richacl.c b/fs/richacl.c > index b2a03c1..ba110a6 100644 > --- a/fs/richacl.c > +++ b/fs/richacl.c > @@ -547,3 +547,74 @@ out: >   return denied ? -EACCES : 0; >  } >  EXPORT_SYMBOL_GPL(richacl_permission); > + > +/** > + * __richacl_chmod  -  update the file masks to reflect the new mode > + * @acl: access control list > + * @mode: new file permission bits including the file type > + * > + * Return a copy of @acl where the file masks have been replaced by the file > + * masks corresponding to the file permission bits in @mode, or returns @acl > + * itself if the file masks are already up to date.  Takes over a reference > + * to @acl. > + */ > +static struct richacl * > +__richacl_chmod(struct richacl *acl, umode_t mode) > +{ > + unsigned int x = S_ISDIR(mode) ? 0 : RICHACE_DELETE_CHILD; > + unsigned int owner_mask, group_mask, other_mask; > + struct richacl *clone; > + > + owner_mask = richacl_mode_to_mask(mode >> 6) & ~x; > + group_mask = richacl_mode_to_mask(mode >> 3) & ~x; > + other_mask = richacl_mode_to_mask(mode)      & ~x; > + > + if (acl->a_owner_mask == owner_mask && > +     acl->a_group_mask == group_mask && > +     acl->a_other_mask == other_mask && > +     (acl->a_flags & RICHACL_MASKED) && > +     (acl->a_flags & RICHACL_WRITE_THROUGH)) > + return acl; > + > + clone = richacl_clone(acl, GFP_KERNEL); > + richacl_put(acl); > + if (!clone) > + return ERR_PTR(-ENOMEM); > + > + clone->a_flags |= (RICHACL_WRITE_THROUGH | RICHACL_MASKED); > + clone->a_owner_mask = owner_mask; > + clone->a_group_mask = group_mask; > + clone->a_other_mask = other_mask; > + > + return clone; > +} > + > +/** > + * richacl_chmod  -  filesystem chmod helper > + * @inode: inode whose file permission bits to change > + * @mode: new file permission bits including the file type > + * > + * Helper for filesystems to use to perform a chmod on the richacl of an inode. > + */ > +int > +richacl_chmod(struct inode *inode, umode_t mode) > +{ > + struct richacl *acl; > + int retval; > + > + if (S_ISLNK(mode)) > + return -EOPNOTSUPP; > + if (!inode->i_op->set_richacl) > + return -EOPNOTSUPP; > + acl = get_richacl(inode); > + if (IS_ERR_OR_NULL(acl)) > + return PTR_ERR(acl); > + acl = __richacl_chmod(acl, mode); > + if (IS_ERR(acl)) > + return PTR_ERR(acl); > + retval = inode->i_op->set_richacl(inode, acl); > + richacl_put(acl); > + > + return retval; > +} > +EXPORT_SYMBOL(richacl_chmod); > diff --git a/include/linux/richacl.h b/include/linux/richacl.h > index 3e05c94..db82fab 100644 > --- a/include/linux/richacl.h > +++ b/include/linux/richacl.h > @@ -190,5 +190,6 @@ extern unsigned int richacl_mode_to_mask(umode_t); >  extern unsigned int richacl_want_to_mask(unsigned int); >  extern void richacl_compute_max_masks(struct richacl *); >  extern int richacl_permission(struct inode *, const struct richacl *, int); > +extern int richacl_chmod(struct inode *, umode_t); >   >  #endif /* __RICHACL_H */ Acked-by: Jeff Layton From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id 626C07CA1 for ; Tue, 12 Jul 2016 06:37:05 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay2.corp.sgi.com (Postfix) with ESMTP id 27734304043 for ; Tue, 12 Jul 2016 04:37:02 -0700 (PDT) Received: from mail-qt0-f170.google.com (mail-qt0-f170.google.com [209.85.216.170]) by cuda.sgi.com with ESMTP id vMF56e5mE5B7D51r (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Tue, 12 Jul 2016 04:36:59 -0700 (PDT) Received: by mail-qt0-f170.google.com with SMTP id j35so6207253qtj.2 for ; Tue, 12 Jul 2016 04:36:59 -0700 (PDT) Message-ID: <1468323416.7798.7.camel@redhat.com> Subject: Re: [PATCH v23 14/22] richacl: Update the file masks in chmod() From: Jeff Layton Date: Tue, 12 Jul 2016 07:36:56 -0400 In-Reply-To: <1467294433-3222-15-git-send-email-agruenba@redhat.com> References: <1467294433-3222-1-git-send-email-agruenba@redhat.com> <1467294433-3222-15-git-send-email-agruenba@redhat.com> Mime-Version: 1.0 List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: Andreas Gruenbacher , Alexander Viro Cc: "J. Bruce Fields" , linux-nfs@vger.kernel.org, Theodore Ts'o , linux-cifs@vger.kernel.org, linux-api@vger.kernel.org, Trond Myklebust , linux-kernel@vger.kernel.org, xfs@oss.sgi.com, Christoph Hellwig , Andreas Dilger , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Anna Schumaker T24gVGh1LCAyMDE2LTA2LTMwIGF0IDE1OjQ3ICswMjAwLCBBbmRyZWFzIEdydWVuYmFjaGVyIHdy b3RlOgo+IERvaW5nIGEgY2htb2QoKSBzZXRzIHRoZSBmaWxlIG1vZGUsIHdoaWNoIGluY2x1ZGVz IHRoZSBmaWxlIHBlcm1pc3Npb24KPiBiaXRzLsKgwqBXaGVuIGEgZmlsZSBoYXMgYSByaWNoYWNs LCB0aGUgcGVybWlzc2lvbnMgdGhhdCB0aGUgcmljaGFjbAo+IGdyYW50cyBuZWVkIHRvIGJlIGxp bWl0ZWQgdG8gd2hhdCB0aGUgbmV3IGZpbGUgcGVybWlzc2lvbiBiaXRzIGFsbG93Lgo+IAo+IFRo aXMgaXMgZG9uZSBieSBzZXR0aW5nIHRoZSBmaWxlIG1hc2tzIGluIHRoZSByaWNoYWNsIHRvIHdo YXQgdGhlIGZpbGUKPiBwZXJtaXNzaW9uIGJpdHMgbWFwIHRvLsKgwqBUaGUgcmljaGFjbCBhY2Nl c3MgY2hlY2sgYWxnb3JpdGhtIHRha2VzIHRoZQo+IGZpbGUgbWFza3MgaW50byBhY2NvdW50LCB3 aGljaCBlbnN1cmVzIHRoYXQgdGhlIHJpY2hhY2wgY2Fubm90IGdyYW50IHRvbwo+IG1h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