From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751950AbdG0Tfq (ORCPT ); Thu, 27 Jul 2017 15:35:46 -0400 Received: from casper.infradead.org ([85.118.1.10]:43862 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdG0Tfn (ORCPT ); Thu, 27 Jul 2017 15:35:43 -0400 Date: Thu, 27 Jul 2017 20:35:33 +0100 (BST) From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin cc: Linux Kernel Mailing List , Lustre Development List , Robin Humble Subject: Re: [PATCH 18/20] staging: lustre: llite: Remove filtering of seclabel xattr In-Reply-To: <1501082556-17962-19-git-send-email-jsimmons@infradead.org> Message-ID: References: <1501082556-17962-1-git-send-email-jsimmons@infradead.org> <1501082556-17962-19-git-send-email-jsimmons@infradead.org> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170727_203533_816110_DBECDB96 X-CRM114-Status: GOOD ( 23.47 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Robin Humble > > The security.capability xattr is used to implement File > Capabilities in recent Linux versions. Capabilities are a > fine grained approach to granting executables elevated > privileges. eg. /bin/ping can have capabilities > cap_net_admin, cap_net_raw+ep instead of being setuid root. > > This xattr has long been filtered out by llite, initially for > stability reasons (b15587), and later over performance > concerns as this xattr is read for every file with eg. > 'ls --color'. Since LU-2869 xattr's are cached on clients, > alleviating most performance concerns. > > Removing llite's filtering of the security.capability xattr > enables using Lustre as a root filesystem, which is used on > some large clusters. The commit message for this patch is incorrect. Some how it got mixed up with another patch which I missed in this push. Please drop this patch and I will resent the correct patches later. > Signed-off-by: Robin Humble > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562 > Reviewed-on: https://review.whamcloud.com/27292 > Reviewed-by: John L. Hammond > Reviewed-by: Sebastien Buisson > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/llite/file.c | 58 ++++++++++++++++++++++ > .../staging/lustre/lustre/llite/llite_internal.h | 4 ++ > drivers/staging/lustre/lustre/llite/namei.c | 6 +++ > 3 files changed, 68 insertions(+) > > diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c > index 215479a..a324580 100644 > --- a/drivers/staging/lustre/lustre/llite/file.c > +++ b/drivers/staging/lustre/lustre/llite/file.c > @@ -3040,6 +3040,61 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type) > return acl; > } > > +#ifdef CONFIG_FS_POSIX_ACL > +int ll_set_acl(struct inode *inode, struct posix_acl *acl, int type) > +{ > + const char *name = NULL; > + char *value = NULL; > + size_t size = 0; > + int rc = 0; > + > + switch (type) { > + case ACL_TYPE_ACCESS: > + if (acl) { > + rc = posix_acl_update_mode(inode, &inode->i_mode, &acl); > + if (rc) > + goto out; > + } > + name = XATTR_NAME_POSIX_ACL_ACCESS; > + break; > + case ACL_TYPE_DEFAULT: > + if (!S_ISDIR(inode->i_mode)) { > + rc = acl ? -EACCES : 0; > + goto out; > + } > + name = XATTR_NAME_POSIX_ACL_DEFAULT; > + break; > + default: > + rc = -EINVAL; > + goto out; > + } > + > + if (acl) { > + size = posix_acl_xattr_size(acl->a_count); > + value = kmalloc(size, GFP_NOFS); > + if (!value) { > + rc = -ENOMEM; > + goto out; > + } > + > + rc = posix_acl_to_xattr(&init_user_ns, acl, value, size); > + if (rc < 0) > + goto out_free; > + } > + > + /* dentry is only used for *.lov attributes so it's safe to be NULL */ > + rc = __vfs_setxattr(NULL, inode, name, value, size, XATTR_CREATE); > +out_free: > + kfree(value); > +out: > + if (!rc) > + set_cached_acl(inode, type, acl); > + else > + forget_cached_acl(inode, type); > + return rc; > +} > +#endif /* CONFIG_FS_POSIX_ACL */ > + > int ll_inode_permission(struct inode *inode, int mask) > { > struct ll_sb_info *sbi; > @@ -3162,6 +3217,9 @@ int ll_inode_permission(struct inode *inode, int mask) > .listxattr = ll_listxattr, > .fiemap = ll_fiemap, > .get_acl = ll_get_acl, > +#ifdef CONFIG_FS_POSIX_ACL > + .set_acl = ll_set_acl, > +#endif > }; > > /* dynamic ioctl number support routines */ > diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h > index cd3311a..b3374bc 100644 > --- a/drivers/staging/lustre/lustre/llite/llite_internal.h > +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h > @@ -752,6 +752,10 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits, > int ll_getattr(const struct path *path, struct kstat *stat, > u32 request_mask, unsigned int flags); > struct posix_acl *ll_get_acl(struct inode *inode, int type); > +#ifdef CONFIG_FS_POSIX_ACL > +int ll_set_acl(struct inode *inode, struct posix_acl *acl, int type); > +#endif /* CONFIG_FS_POSIX_ACL */ > + > int ll_migrate(struct inode *parent, struct file *file, int mdtidx, > const char *name, int namelen); > int ll_get_fid_by_name(struct inode *parent, const char *name, > diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c > index a208a8b..14dccbe 100644 > --- a/drivers/staging/lustre/lustre/llite/namei.c > +++ b/drivers/staging/lustre/lustre/llite/namei.c > @@ -1187,6 +1187,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, > .permission = ll_inode_permission, > .listxattr = ll_listxattr, > .get_acl = ll_get_acl, > +#ifdef CONFIG_FS_POSIX_ACL > + .set_acl = ll_set_acl, > +#endif > }; > > const struct inode_operations ll_special_inode_operations = { > @@ -1195,4 +1198,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, > .permission = ll_inode_permission, > .listxattr = ll_listxattr, > .get_acl = ll_get_acl, > +#ifdef CONFIG_FS_POSIX_ACL > + .set_acl = ll_set_acl, > +#endif > }; > -- > 1.8.3.1 > >