linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/7] ubifs: Remove unused security xattr handler
       [not found] <1442924812-9384-1-git-send-email-agruenba@redhat.com>
@ 2015-09-22 12:26 ` Andreas Gruenbacher
  2015-09-22 12:41   ` Richard Weinberger
  2015-09-22 12:26 ` [PATCH v2 3/7] jffs2: Add missing capability check for listing trusted xattrs Andreas Gruenbacher
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Gruenbacher @ 2015-09-22 12:26 UTC (permalink / raw)
  To: Alexander Viro, Christoph Hellwig, linux-kernel, linux-fsdevel,
	Artem Bityutskiy, Adrian Hunter, linux-mtd
  Cc: Subodh Nijsure

Ubifs installs a security xattr handler in sb->s_xattr but doesn't use the
generic_{get,set,list,remove}xattr inode operations needed for processing
this list of attribute handlers; the handler is never called.  Instead,
ubifs uses its own xattr handlers which also process security xattrs.

Remove the dead code.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Subodh Nijsure <snijsure@grid-net.com>
---
 fs/ubifs/super.c |  1 -
 fs/ubifs/ubifs.h |  1 -
 fs/ubifs/xattr.c | 40 ----------------------------------------
 3 files changed, 42 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 9547a278..c71edca 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2037,7 +2037,6 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
 	if (c->max_inode_sz > MAX_LFS_FILESIZE)
 		sb->s_maxbytes = c->max_inode_sz = MAX_LFS_FILESIZE;
 	sb->s_op = &ubifs_super_operations;
-	sb->s_xattr = ubifs_xattr_handlers;
 
 	mutex_lock(&c->umount_mutex);
 	err = mount_ubifs(c);
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index de75902..33b6ee7 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1470,7 +1470,6 @@ extern spinlock_t ubifs_infos_lock;
 extern atomic_long_t ubifs_clean_zn_cnt;
 extern struct kmem_cache *ubifs_inode_slab;
 extern const struct super_operations ubifs_super_operations;
-extern const struct xattr_handler *ubifs_xattr_handlers[];
 extern const struct address_space_operations ubifs_file_address_operations;
 extern const struct file_operations ubifs_file_operations;
 extern const struct inode_operations ubifs_file_inode_operations;
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 96f3448..b512b14 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -582,46 +582,6 @@ out_free:
 	return err;
 }
 
-static size_t security_listxattr(struct dentry *d, char *list, size_t list_size,
-				 const char *name, size_t name_len, int flags)
-{
-	const int prefix_len = XATTR_SECURITY_PREFIX_LEN;
-	const size_t total_len = prefix_len + name_len + 1;
-
-	if (list && total_len <= list_size) {
-		memcpy(list, XATTR_SECURITY_PREFIX, prefix_len);
-		memcpy(list + prefix_len, name, name_len);
-		list[prefix_len + name_len] = '\0';
-	}
-
-	return total_len;
-}
-
-static int security_getxattr(struct dentry *d, const char *name, void *buffer,
-		      size_t size, int flags)
-{
-	return ubifs_getxattr(d, name, buffer, size);
-}
-
-static int security_setxattr(struct dentry *d, const char *name,
-			     const void *value, size_t size, int flags,
-			     int handler_flags)
-{
-	return ubifs_setxattr(d, name, value, size, flags);
-}
-
-static const struct xattr_handler ubifs_xattr_security_handler = {
-	.prefix = XATTR_SECURITY_PREFIX,
-	.list   = security_listxattr,
-	.get    = security_getxattr,
-	.set    = security_setxattr,
-};
-
-const struct xattr_handler *ubifs_xattr_handlers[] = {
-	&ubifs_xattr_security_handler,
-	NULL,
-};
-
 static int init_xattrs(struct inode *inode, const struct xattr *xattr_array,
 		      void *fs_info)
 {
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/7] jffs2: Add missing capability check for listing trusted xattrs
       [not found] <1442924812-9384-1-git-send-email-agruenba@redhat.com>
  2015-09-22 12:26 ` [PATCH v2 1/7] ubifs: Remove unused security xattr handler Andreas Gruenbacher
@ 2015-09-22 12:26 ` Andreas Gruenbacher
  2015-10-04  6:25   ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Gruenbacher @ 2015-09-22 12:26 UTC (permalink / raw)
  To: Alexander Viro, Christoph Hellwig, linux-kernel, linux-fsdevel,
	David Woodhouse, linux-mtd

The vfs checks if a task has the appropriate access for get and set
operations, but it cannot do that for the list operation; the file system
must check for that itself.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/jffs2/xattr_trusted.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c
index ceaf9c6..bbd20c1 100644
--- a/fs/jffs2/xattr_trusted.c
+++ b/fs/jffs2/xattr_trusted.c
@@ -39,6 +39,9 @@ static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list,
 {
 	size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1;
 
+	if (!capable(CAP_SYS_ADMIN))
+		return 0;
+
 	if (list && retlen<=list_size) {
 		strcpy(list, XATTR_TRUSTED_PREFIX);
 		strcpy(list + XATTR_TRUSTED_PREFIX_LEN, name);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/7] ubifs: Remove unused security xattr handler
  2015-09-22 12:26 ` [PATCH v2 1/7] ubifs: Remove unused security xattr handler Andreas Gruenbacher
@ 2015-09-22 12:41   ` Richard Weinberger
  2015-09-22 12:47     ` Andreas Gruenbacher
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2015-09-22 12:41 UTC (permalink / raw)
  To: Andreas Gruenbacher
  Cc: Alexander Viro, Christoph Hellwig, LKML, linux-fsdevel,
	Artem Bityutskiy, Adrian Hunter, linux-mtd@lists.infradead.org,
	Subodh Nijsure

On Tue, Sep 22, 2015 at 2:26 PM, Andreas Gruenbacher
<agruenba@redhat.com> wrote:
> Ubifs installs a security xattr handler in sb->s_xattr but doesn't use the
> generic_{get,set,list,remove}xattr inode operations needed for processing
> this list of attribute handlers; the handler is never called.  Instead,
> ubifs uses its own xattr handlers which also process security xattrs.
>
> Remove the dead code.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> Cc: Subodh Nijsure <snijsure@grid-net.com>

Should this go through the ubifs tree or do you carry it?

Anyway,
Reviewed-by: Richard Weinberger <richard@nod.at>

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/7] ubifs: Remove unused security xattr handler
  2015-09-22 12:41   ` Richard Weinberger
@ 2015-09-22 12:47     ` Andreas Gruenbacher
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Gruenbacher @ 2015-09-22 12:47 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Alexander Viro, Christoph Hellwig, LKML, linux-fsdevel,
	Artem Bityutskiy, Adrian Hunter, linux-mtd@lists.infradead.org,
	Subodh Nijsure

2015-09-22 14:41 GMT+02:00 Richard Weinberger <richard.weinberger@gmail.com>:
> Should this go through the ubifs tree or do you carry it?

I hope that Al will take these patches from me. The filesystem patches
are not so exciting from a filesystem point of view.

Thanks,
Andreas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 3/7] jffs2: Add missing capability check for listing trusted xattrs
  2015-09-22 12:26 ` [PATCH v2 3/7] jffs2: Add missing capability check for listing trusted xattrs Andreas Gruenbacher
@ 2015-10-04  6:25   ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2015-10-04  6:25 UTC (permalink / raw)
  To: Andreas Gruenbacher
  Cc: Alexander Viro, linux-kernel, linux-fsdevel, David Woodhouse,
	linux-mtd

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-04  6:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1442924812-9384-1-git-send-email-agruenba@redhat.com>
2015-09-22 12:26 ` [PATCH v2 1/7] ubifs: Remove unused security xattr handler Andreas Gruenbacher
2015-09-22 12:41   ` Richard Weinberger
2015-09-22 12:47     ` Andreas Gruenbacher
2015-09-22 12:26 ` [PATCH v2 3/7] jffs2: Add missing capability check for listing trusted xattrs Andreas Gruenbacher
2015-10-04  6:25   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).