cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3
@ 2013-12-20 13:16 Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 01/21] reiserfs: prefix ACL symbols with reiserfs_ Christoph Hellwig
                   ` (22 more replies)
  0 siblings, 23 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This series consolidates the various cut'n'pasted Posix ACL implementations
into a single common one based on the ->get_acl method Linus added a while
ago and a new ->set_acl counterpart.

This remove ~1800 lines of code and provides a single place to implement
various nasty little gems of the semantics.

Unfortunately the 9p code is still left out - it implements the ACLs
in two very weird ways, one using the common code but on the client only,
and one pasing things straight through to the server.  We could easily
convert it to the new code on the write side if ->set_acl took a dentry,
but there's no cance to do that on the ->get_acl side.  Ideas how to
handle it welcome.

After that we'd be ready to never go into the fs for the ACL attributes
and branch straight to the ACL code below the syscall, repairing the
old API braindamage of overloading ACLs onto the xattrs.


Changes from V2:
 - remove redundant S_ISLNK checks
 - fix the get_acl return value
 - remove spurious symlink get_acl instance in gfs2
 - fix default ACL inheritance on NFS
 - use get_acl and set_acl from the NFS server
 - remove some incorrectly copy&pasted code in hfsplus

Changes from V1:
 - check for symlinks in the ACL code and remove checks in the lower
   level functions.
 - remove get_acl instances for symlinks in a few filesystems
 - pass a umode_t mode argument to posix_acl_chmod to accomodate f2fs
 - various cosemtic bits from the reviews.

Note that I still haven't heard from ocfs2 folks, so the patch is left
unchanged.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Jfs-discussion mailing list
Jfs-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jfs-discussion



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

* [Cluster-devel] [PATCH 01/21] reiserfs: prefix ACL symbols with reiserfs_
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 02/21] fs: merge xattr_acl.c into posix_acl.c Christoph Hellwig
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0001-reiserfs-prefix-ACL-symbols-with-reiserfs_.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/71f3c5d1/attachment.ksh>

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

* [Cluster-devel] [PATCH 02/21] fs: merge xattr_acl.c into posix_acl.c
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 01/21] reiserfs: prefix ACL symbols with reiserfs_ Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 03/21] fs: add get_acl helper Christoph Hellwig
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0002-fs-merge-xattr_acl.c-into-posix_acl.c.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/01f1e190/attachment.ksh>

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

* [Cluster-devel] [PATCH 03/21] fs: add get_acl helper
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 01/21] reiserfs: prefix ACL symbols with reiserfs_ Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 02/21] fs: merge xattr_acl.c into posix_acl.c Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 04/21] fs: add a set_acl inode operation Christoph Hellwig
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0003-fs-add-get_acl-helper.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/c734f688/attachment.ksh>

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

* [Cluster-devel] [PATCH 04/21] fs: add a set_acl inode operation
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 03/21] fs: add get_acl helper Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 05/21] fs: add generic xattr_acl handlers Christoph Hellwig
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0004-fs-add-a-set_acl-inode-operation.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/edd89d19/attachment.ksh>

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

* [Cluster-devel] [PATCH 05/21] fs: add generic xattr_acl handlers
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 04/21] fs: add a set_acl inode operation Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 06/21] fs: make posix_acl_chmod more useful Christoph Hellwig
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0005-fs-add-generic-xattr_acl-handlers.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/93c998cb/attachment.ksh>

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

* [Cluster-devel] [PATCH 06/21] fs: make posix_acl_chmod more useful
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (4 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 05/21] fs: add generic xattr_acl handlers Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 07/21] fs: make posix_acl_create " Christoph Hellwig
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0006-fs-make-posix_acl_chmod-more-useful.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/d2a5e8ef/attachment.ksh>

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

* [Cluster-devel] [PATCH 07/21] fs: make posix_acl_create more useful
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (5 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 06/21] fs: make posix_acl_chmod more useful Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 08/21] btrfs: use generic posix ACL infrastructure Christoph Hellwig
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0007-fs-make-posix_acl_create-more-useful.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/f24eafa8/attachment.ksh>

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

* [Cluster-devel] [PATCH 08/21] btrfs: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (6 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 07/21] fs: make posix_acl_create " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 09/21] ext2/3/4: " Christoph Hellwig
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0008-btrfs-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/0daf8479/attachment.ksh>

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

* [Cluster-devel] [PATCH 09/21] ext2/3/4: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (7 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 08/21] btrfs: use generic posix ACL infrastructure Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 10/21] f2fs: " Christoph Hellwig
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0009-ext2-3-4-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/696686ee/attachment.ksh>

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

* [Cluster-devel] [PATCH 10/21] f2fs: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (8 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 09/21] ext2/3/4: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 11/21] hfsplus: " Christoph Hellwig
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0010-f2fs-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/ed8f998a/attachment.ksh>

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

* [Cluster-devel] [PATCH 11/21] hfsplus: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (9 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 10/21] f2fs: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 12/21] jffs2: " Christoph Hellwig
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0011-hfsplus-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/600a870f/attachment.ksh>

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

* [Cluster-devel] [PATCH 12/21] jffs2: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (10 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 11/21] hfsplus: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 13/21] ocfs2: " Christoph Hellwig
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0012-jffs2-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/7d7bf831/attachment.ksh>

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

* [Cluster-devel] [PATCH 13/21] ocfs2: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (11 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 12/21] jffs2: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 14/21] reiserfs: " Christoph Hellwig
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0013-ocfs2-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/f84f0df9/attachment.ksh>

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

* [Cluster-devel] [PATCH 14/21] reiserfs: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (12 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 13/21] ocfs2: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 15/21] xfs: " Christoph Hellwig
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0014-reiserfs-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/1b66d740/attachment.ksh>

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

* [Cluster-devel] [PATCH 15/21] xfs: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (13 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 14/21] reiserfs: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 16/21] jfs: " Christoph Hellwig
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0015-xfs-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/f58b1b4d/attachment.ksh>

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

* [Cluster-devel] [PATCH 16/21] jfs: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (14 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 15/21] xfs: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 17/21] gfs2: " Christoph Hellwig
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0016-jfs-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/e50ce338/attachment.ksh>

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

* [Cluster-devel] [PATCH 17/21] gfs2: use generic posix ACL infrastructure
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (15 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 16/21] jfs: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 18/21] nfs: use generic posix ACL infrastructure for v3 Posix ACLs Christoph Hellwig
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0017-gfs2-use-generic-posix-ACL-infrastructure.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/8089dc1e/attachment.ksh>

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

* [Cluster-devel] [PATCH 18/21] nfs: use generic posix ACL infrastructure for v3 Posix ACLs
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (16 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 17/21] gfs2: " Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 19/21] fs: remove generic_acl Christoph Hellwig
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0018-nfs-use-generic-posix-ACL-infrastructure-for-v3-Posi.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/6391b5d1/attachment.ksh>

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

* [Cluster-devel] [PATCH 19/21] fs: remove generic_acl
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (17 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 18/21] nfs: use generic posix ACL infrastructure for v3 Posix ACLs Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 20/21] nfsd: use get_acl and ->set_acl Christoph Hellwig
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0019-fs-remove-generic_acl.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/07b46130/attachment.ksh>

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

* [Cluster-devel] [PATCH 20/21] nfsd: use get_acl and ->set_acl
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (18 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 19/21] fs: remove generic_acl Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr Christoph Hellwig
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0020-nfsd-use-get_acl-and-set_acl.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/cfafac9c/attachment.ksh>

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

* [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (19 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 20/21] nfsd: use get_acl and ->set_acl Christoph Hellwig
@ 2013-12-20 13:16 ` Christoph Hellwig
  2013-12-21 17:07   ` Vyacheslav Dubeyko
  2013-12-23 16:57 ` [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Chris Mason
  2014-01-07 15:53 ` Christoph Hellwig
  22 siblings, 1 reply; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-20 13:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

An embedded and charset-unspecified text was scrubbed...
Name: 0021-hfsplus-remove-can_set_xattr.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20131220/0b42b948/attachment.ksh>

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

* [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr Christoph Hellwig
@ 2013-12-21 17:07   ` Vyacheslav Dubeyko
  2013-12-22 19:28     ` Christoph Hellwig
  0 siblings, 1 reply; 30+ messages in thread
From: Vyacheslav Dubeyko @ 2013-12-21 17:07 UTC (permalink / raw)
  To: cluster-devel.redhat.com


On Dec 20, 2013, at 4:16 PM, Christoph Hellwig wrote:

> When using the per-superblock xattr handlers permission checking is
> done by the generic code.  hfsplus just needs to check for the magic
> osx attribute not to leak into protected namespaces.
> 
> Also given that the code was obviously copied from JFS the proper
> attribution was missing.
> 

I don't think that this code changing is correct. Current modification
breaks logic. Please, see my comments below.

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/hfsplus/xattr.c |   87 ++--------------------------------------------------
> 1 file changed, 3 insertions(+), 84 deletions(-)
> 
> diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
> index bf88baa..0b4a5c9 100644
> --- a/fs/hfsplus/xattr.c
> +++ b/fs/hfsplus/xattr.c
> @@ -52,82 +52,6 @@ static inline int is_known_namespace(const char *name)
> 	return true;
> }
> 
> -static int can_set_system_xattr(struct inode *inode, const char *name,
> -				const void *value, size_t size)

I agree that it makes sense to remove this code if permission checking
is done by generic code.

> -{
> -#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
> -	struct posix_acl *acl;
> -	int err;
> -
> -	if (!inode_owner_or_capable(inode))
> -		return -EPERM;
> -
> -	/*
> -	 * POSIX_ACL_XATTR_ACCESS is tied to i_mode
> -	 */
> -	if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) {
> -		acl = posix_acl_from_xattr(&init_user_ns, value, size);
> -		if (IS_ERR(acl))
> -			return PTR_ERR(acl);
> -		if (acl) {
> -			err = posix_acl_equiv_mode(acl, &inode->i_mode);
> -			posix_acl_release(acl);
> -			if (err < 0)
> -				return err;
> -			mark_inode_dirty(inode);
> -		}
> -		/*
> -		 * We're changing the ACL.  Get rid of the cached one
> -		 */
> -		forget_cached_acl(inode, ACL_TYPE_ACCESS);
> -
> -		return 0;
> -	} else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) {
> -		acl = posix_acl_from_xattr(&init_user_ns, value, size);
> -		if (IS_ERR(acl))
> -			return PTR_ERR(acl);
> -		posix_acl_release(acl);
> -
> -		/*
> -		 * We're changing the default ACL.  Get rid of the cached one
> -		 */
> -		forget_cached_acl(inode, ACL_TYPE_DEFAULT);
> -
> -		return 0;
> -	}
> -#endif /* CONFIG_HFSPLUS_FS_POSIX_ACL */
> -	return -EOPNOTSUPP;
> -}
> -
> -static int can_set_xattr(struct inode *inode, const char *name,
> -				const void *value, size_t value_len)

This function works for all handlers. So, I don't think that it makes sense
to delete it.

> -{
> -	if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
> -		return can_set_system_xattr(inode, name, value, value_len);
> -

I agree that it needs to remove this check for XATTR_SYSTEM_PREFIX case.

> -	if (!strncmp(name, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN)) {
> -		/*
> -		 * This makes sure that we aren't trying to set an
> -		 * attribute in a different namespace by prefixing it
> -		 * with "osx."
> -		 */
> -		if (is_known_namespace(name + XATTR_MAC_OSX_PREFIX_LEN))
> -			return -EOPNOTSUPP;

I think that this check is important. It forbids such combinations as "osx.system.*" or
"osx.trusted.*", for example. Because "osx.*" is virtual namespace for xattrs that
it can be under Mac OS X. If you want to set xattr from "system.*" namespace, for example,
then you need to use another handler. And such namespace should be without
addition of "osx." prefix.

> -
> -		return 0;
> -	}
> -
> -	/*
> -	 * Don't allow setting an attribute in an unknown namespace.
> -	 */
> -	if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
> -	    strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) &&
> -	    strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
> -		return -EOPNOTSUPP;
> -
> -	return 0;
> -}
> -
> static void hfsplus_init_header_node(struct inode *attr_file,
> 					u32 clump_size,
> 					char *buf, u16 node_size)
> @@ -350,10 +274,6 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
> 				HFSPLUS_IS_RSRC(inode))
> 		return -EOPNOTSUPP;
> 
> -	err = can_set_xattr(inode, name, value, size);

The __hfsplus_setxattr() is common method for all handlers. So, removing
this call means that we don't check validity of namespace. I don't think
that such modification is a right way.

> -	if (err)
> -		return err;
> -
> 	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
> 				XATTR_MAC_OSX_PREFIX_LEN) == 0)
> 		name += XATTR_MAC_OSX_PREFIX_LEN;
> @@ -841,10 +761,6 @@ int hfsplus_removexattr(struct dentry *dentry, const char *name)
> 	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
> 		return -EOPNOTSUPP;
> 
> -	err = can_set_xattr(inode, name, NULL, 0);

Ditto. Moreover, it is used namely hfsplus_removexattr() and not
__hfsplus_setxattr() for removing xattrs in hfsplus driver. So, removing
this check is not good way.

> -	if (err)
> -		return err;
> -
> 	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
> 				XATTR_MAC_OSX_PREFIX_LEN) == 0)
> 		name += XATTR_MAC_OSX_PREFIX_LEN;
> @@ -941,6 +857,9 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
> 	if (len > HFSPLUS_ATTR_MAX_STRLEN)
> 		return -EOPNOTSUPP;
> 
> +	if (is_known_namespace(name))
> +		return -EOPNOTSUPP;

If common check in __hfsplus_setxattr() will be on the same place then
this addition doesn't make sense.

Thanks,
Vyacheslav Dubeyko.

> +
> 	strcpy(xattr_name, XATTR_MAC_OSX_PREFIX);
> 	strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name);
> 
> -- 
> 1.7.10.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

* [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr
  2013-12-21 17:07   ` Vyacheslav Dubeyko
@ 2013-12-22 19:28     ` Christoph Hellwig
  2013-12-23  6:40       ` Vyacheslav Dubeyko
  0 siblings, 1 reply; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-22 19:28 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Sat, Dec 21, 2013 at 08:07:51PM +0300, Vyacheslav Dubeyko wrote:
> > -static int can_set_xattr(struct inode *inode, const char *name,
> > -				const void *value, size_t value_len)
> 
> This function works for all handlers. So, I don't think that it makes sense
> to delete it.

It "works" in a minimal sense that it won't crash or actively cause
harm.  But it also is useless except for the check that we can abuse
the osx namespace to set an attribute in another namespace, which we
still do in the proper way after my patch.

> > -	if (!strncmp(name, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN)) {
> > -		/*
> > -		 * This makes sure that we aren't trying to set an
> > -		 * attribute in a different namespace by prefixing it
> > -		 * with "osx."
> > -		 */
> > -		if (is_known_namespace(name + XATTR_MAC_OSX_PREFIX_LEN))
> > -			return -EOPNOTSUPP;
> 
> I think that this check is important. It forbids such combinations as "osx.system.*" or
> "osx.trusted.*", for example. Because "osx.*" is virtual namespace for xattrs that
> it can be under Mac OS X. If you want to set xattr from "system.*" namespace, for example,
> then you need to use another handler. And such namespace should be without
> addition of "osx." prefix.

Right, and we keep exactly the check, just in a different place.

> The __hfsplus_setxattr() is common method for all handlers. So, removing
> this call means that we don't check validity of namespace. I don't think
> that such modification is a right way.

The generic code already checks for the validity of the namespace for
you. xattr_resolve_name in fs/xattr.c makes sure only attributes for a
namespace that the filesystem registered can be set or modified.

> > @@ -841,10 +761,6 @@ int hfsplus_removexattr(struct dentry *dentry, const char *name)
> > 	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
> > 		return -EOPNOTSUPP;
> > 
> > -	err = can_set_xattr(inode, name, NULL, 0);
> 
> Ditto. Moreover, it is used namely hfsplus_removexattr() and not
> __hfsplus_setxattr() for removing xattrs in hfsplus driver. So, removing
> this check is not good way.

Oh, I just noticed that hfsplus does not use the xattr handlers for
removing, while it does for getting and setting xattrs.  That's a really
bad a confusing design, and we'll indeed need to fix that as well.

> > 	if (len > HFSPLUS_ATTR_MAX_STRLEN)
> > 		return -EOPNOTSUPP;
> > 
> > +	if (is_known_namespace(name))
> > +		return -EOPNOTSUPP;
> 
> If common check in __hfsplus_setxattr() will be on the same place then
> this addition doesn't make sense.

Having both does indeed not make sense, but this is the better place to
have it.



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

* [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr
  2013-12-22 19:28     ` Christoph Hellwig
@ 2013-12-23  6:40       ` Vyacheslav Dubeyko
  2013-12-23 14:37         ` Christoph Hellwig
  0 siblings, 1 reply; 30+ messages in thread
From: Vyacheslav Dubeyko @ 2013-12-23  6:40 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Sun, 2013-12-22 at 11:28 -0800, Christoph Hellwig wrote:

> 
> > > -	if (!strncmp(name, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN)) {
> > > -		/*
> > > -		 * This makes sure that we aren't trying to set an
> > > -		 * attribute in a different namespace by prefixing it
> > > -		 * with "osx."
> > > -		 */
> > > -		if (is_known_namespace(name + XATTR_MAC_OSX_PREFIX_LEN))
> > > -			return -EOPNOTSUPP;
> > 
> > I think that this check is important. It forbids such combinations as "osx.system.*" or
> > "osx.trusted.*", for example. Because "osx.*" is virtual namespace for xattrs that
> > it can be under Mac OS X. If you want to set xattr from "system.*" namespace, for example,
> > then you need to use another handler. And such namespace should be without
> > addition of "osx." prefix.
> 
> Right, and we keep exactly the check, just in a different place.
> 

Maybe I missed something, but I can see that this check is removed only.
Could you point out the code in your patch that it checks and forbids
such combination as "osx.security.*", "osx.trusted.*" and so on?

I can see that is_known_namespace() is called for
hfsplus_xattr_osx_handler only. But this method doesn't contain
above-mentioned check. Moreover, hfsplus_xattr_user_handler,
hfsplus_xattr_trusted_handler, hfsplus_xattr_security_handler will be
without is_know_namespace() check. What about it?

> > The __hfsplus_setxattr() is common method for all handlers. So, removing
> > this call means that we don't check validity of namespace. I don't think
> > that such modification is a right way.
> 
> The generic code already checks for the validity of the namespace for
> you. xattr_resolve_name in fs/xattr.c makes sure only attributes for a
> namespace that the filesystem registered can be set or modified.
> 

But generic code doesn't check such names combination that it is treated
as wrong for concrete file systems. For example, "osx.security.*" is
wrong for the case of HFS+. Because it will works
hfsplus_xattr_osx_handler instead of hfsplus_xattr_security_handler.

> > > @@ -841,10 +761,6 @@ int hfsplus_removexattr(struct dentry *dentry, const char *name)
> > > 	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
> > > 		return -EOPNOTSUPP;
> > > 
> > > -	err = can_set_xattr(inode, name, NULL, 0);
> > 
> > Ditto. Moreover, it is used namely hfsplus_removexattr() and not
> > __hfsplus_setxattr() for removing xattrs in hfsplus driver. So, removing
> > this check is not good way.
> 
> Oh, I just noticed that hfsplus does not use the xattr handlers for
> removing, while it does for getting and setting xattrs.  That's a really
> bad a confusing design, and we'll indeed need to fix that as well.
> 

Why bad design? Do you mean that using .removexattr callback is bad
idea?

So, if it needs to use xattr handler only for removing then it needs to
make some refactoring of using __hfsplus_setxattr() and
hfsplus_removexattr() or merging these two functions into one. And I
think that merging is better idea.

Thanks,
Vyacheslav Dubeyko.




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

* [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr
  2013-12-23  6:40       ` Vyacheslav Dubeyko
@ 2013-12-23 14:37         ` Christoph Hellwig
  2013-12-24  6:41           ` Vyacheslav Dubeyko
  0 siblings, 1 reply; 30+ messages in thread
From: Christoph Hellwig @ 2013-12-23 14:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Mon, Dec 23, 2013 at 10:40:09AM +0400, Vyacheslav Dubeyko wrote:
> Maybe I missed something, but I can see that this check is removed only.
> Could you point out the code in your patch that it checks and forbids
> such combination as "osx.security.*", "osx.trusted.*" and so on?

@@ -941,6 +857,9 @@ static int hfsplus_osx_setxattr(struct dentry
*dentry, const char *name,
        if (len > HFSPLUS_ATTR_MAX_STRLEN)
		return -EOPNOTSUPP;

+       if (is_known_namespace(name))
+               return -EOPNOTSUPP;
+


> I can see that is_known_namespace() is called for
> hfsplus_xattr_osx_handler only. But this method doesn't contain
> above-mentioned check. Moreover, hfsplus_xattr_user_handler,
> hfsplus_xattr_trusted_handler, hfsplus_xattr_security_handler will be
> without is_know_namespace() check. What about it?

They only allow you to set user.*, trusted.* and security.* attributs,
because the only get called for it.  For osx.* attributes the osx
handler gets called, and passed the name minus the osx prefix, which
is why the above check will catch it.

> Why bad design? Do you mean that using .removexattr callback is bad
> idea?

Using the handlers for set and get and not using them for remove is a
bad design, because it uses different levels of abstraction for
related operations.  I'm also increasingly of the opnion that we
should not allow the non-handler version, and that we should not permit
filesystems to create their own namespaces, but that's an unrelated
discussion.

> So, if it needs to use xattr handler only for removing then it needs to
> make some refactoring of using __hfsplus_setxattr() and
> hfsplus_removexattr() or merging these two functions into one. And I
> think that merging is better idea.

I've not done the full merge, but below is an updated patch to make
sure hfsplus uses the handlers for the remove case, and making sure
the adding/striping of the prefix for the osv handlers is more
transparent:

diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 9ee6298..bdec665 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -529,7 +529,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
 	.setxattr		= generic_setxattr,
 	.getxattr		= generic_getxattr,
 	.listxattr		= hfsplus_listxattr,
-	.removexattr		= hfsplus_removexattr,
+	.removexattr		= generic_removexattr,
 #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
 	.get_acl		= hfsplus_get_posix_acl,
 	.set_acl		= hfsplus_set_posix_acl,
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 2e10993..83c9166 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -390,7 +390,7 @@ static const struct inode_operations hfsplus_file_inode_operations = {
 	.setxattr	= generic_setxattr,
 	.getxattr	= generic_getxattr,
 	.listxattr	= hfsplus_listxattr,
-	.removexattr	= hfsplus_removexattr,
+	.removexattr	= generic_removexattr,
 #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
 	.get_acl	= hfsplus_get_posix_acl,
 	.set_acl	= hfsplus_set_posix_acl,
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index bf88baa..c838b84 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -11,6 +11,8 @@
 #include "xattr.h"
 #include "acl.h"
 
+static int hfsplus_removexattr(struct inode *inode, const char *name);
+
 const struct xattr_handler *hfsplus_xattr_handlers[] = {
 	&hfsplus_xattr_osx_handler,
 	&hfsplus_xattr_user_handler,
@@ -52,82 +54,6 @@ static inline int is_known_namespace(const char *name)
 	return true;
 }
 
-static int can_set_system_xattr(struct inode *inode, const char *name,
-				const void *value, size_t size)
-{
-#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
-	struct posix_acl *acl;
-	int err;
-
-	if (!inode_owner_or_capable(inode))
-		return -EPERM;
-
-	/*
-	 * POSIX_ACL_XATTR_ACCESS is tied to i_mode
-	 */
-	if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) {
-		acl = posix_acl_from_xattr(&init_user_ns, value, size);
-		if (IS_ERR(acl))
-			return PTR_ERR(acl);
-		if (acl) {
-			err = posix_acl_equiv_mode(acl, &inode->i_mode);
-			posix_acl_release(acl);
-			if (err < 0)
-				return err;
-			mark_inode_dirty(inode);
-		}
-		/*
-		 * We're changing the ACL.  Get rid of the cached one
-		 */
-		forget_cached_acl(inode, ACL_TYPE_ACCESS);
-
-		return 0;
-	} else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) {
-		acl = posix_acl_from_xattr(&init_user_ns, value, size);
-		if (IS_ERR(acl))
-			return PTR_ERR(acl);
-		posix_acl_release(acl);
-
-		/*
-		 * We're changing the default ACL.  Get rid of the cached one
-		 */
-		forget_cached_acl(inode, ACL_TYPE_DEFAULT);
-
-		return 0;
-	}
-#endif /* CONFIG_HFSPLUS_FS_POSIX_ACL */
-	return -EOPNOTSUPP;
-}
-
-static int can_set_xattr(struct inode *inode, const char *name,
-				const void *value, size_t value_len)
-{
-	if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
-		return can_set_system_xattr(inode, name, value, value_len);
-
-	if (!strncmp(name, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN)) {
-		/*
-		 * This makes sure that we aren't trying to set an
-		 * attribute in a different namespace by prefixing it
-		 * with "osx."
-		 */
-		if (is_known_namespace(name + XATTR_MAC_OSX_PREFIX_LEN))
-			return -EOPNOTSUPP;
-
-		return 0;
-	}
-
-	/*
-	 * Don't allow setting an attribute in an unknown namespace.
-	 */
-	if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
-	    strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) &&
-	    strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
-		return -EOPNOTSUPP;
-
-	return 0;
-}
-
 static void hfsplus_init_header_node(struct inode *attr_file,
 					u32 clump_size,
 					char *buf, u16 node_size)
@@ -350,18 +276,8 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
 				HFSPLUS_IS_RSRC(inode))
 		return -EOPNOTSUPP;
 
-	err = can_set_xattr(inode, name, value, size);
-	if (err)
-		return err;
-
-	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
-				XATTR_MAC_OSX_PREFIX_LEN) == 0)
-		name += XATTR_MAC_OSX_PREFIX_LEN;
-
-	if (value == NULL) {
-		value = "";
-		size = 0;
-	}
+	if (value == NULL)
+		return hfsplus_removexattr(inode, name);
 
 	err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &cat_fd);
 	if (err) {
@@ -577,18 +493,6 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
 				HFSPLUS_IS_RSRC(inode))
 		return -EOPNOTSUPP;
 
-	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
-				XATTR_MAC_OSX_PREFIX_LEN) == 0) {
-		/* skip "osx." prefix */
-		name += XATTR_MAC_OSX_PREFIX_LEN;
-		/*
-		 * Don't allow retrieving properly prefixed attributes
-		 * by prepending them with "osx."
-		 */
-		if (is_known_namespace(name))
-			return -EOPNOTSUPP;
-	}
-
 	if (!strcmp_xattr_finder_info(name))
 		return hfsplus_getxattr_finder_info(inode, value, size);
 
@@ -823,32 +727,18 @@ end_listxattr:
 	return res;
 }
 
-int hfsplus_removexattr(struct dentry *dentry, const char *name)
+static int hfsplus_removexattr(struct inode *inode, const char *name)
 {
 	int err = 0;
-	struct inode *inode = dentry->d_inode;
 	struct hfs_find_data cat_fd;
 	u16 flags;
 	u16 cat_entry_type;
 	int is_xattr_acl_deleted = 0;
 	int is_all_xattrs_deleted = 0;
 
-	if ((!S_ISREG(inode->i_mode) &&
-			!S_ISDIR(inode->i_mode)) ||
-				HFSPLUS_IS_RSRC(inode))
-		return -EOPNOTSUPP;
-
 	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
 		return -EOPNOTSUPP;
 
-	err = can_set_xattr(inode, name, NULL, 0);
-	if (err)
-		return err;
-
-	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
-				XATTR_MAC_OSX_PREFIX_LEN) == 0)
-		name += XATTR_MAC_OSX_PREFIX_LEN;
-
 	if (!strcmp_xattr_finder_info(name))
 		return -EOPNOTSUPP;
 
@@ -922,8 +812,12 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
 	if (len > HFSPLUS_ATTR_MAX_STRLEN)
 		return -EOPNOTSUPP;
 
-	strcpy(xattr_name, XATTR_MAC_OSX_PREFIX);
-	strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name);
+	/*
+	 * Don't allow retrieving properly prefixed attributes
+	 * by prepending them with "osx."
+	 */
+	if (is_known_namespace(name))
+		return -EOPNOTSUPP;
 
 	return hfsplus_getxattr(dentry, xattr_name, buffer, size);
 }
@@ -941,8 +835,12 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
 	if (len > HFSPLUS_ATTR_MAX_STRLEN)
 		return -EOPNOTSUPP;
 
-	strcpy(xattr_name, XATTR_MAC_OSX_PREFIX);
-	strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name);
+	/*
+	 * Don't allow setting properly prefixed attributes
+	 * by prepending them with "osx."
+	 */
+	if (is_known_namespace(name))
+		return -EOPNOTSUPP;
 
 	return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags);
 }
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h
index 9e21449..288530c 100644
--- a/fs/hfsplus/xattr.h
+++ b/fs/hfsplus/xattr.h
@@ -40,8 +40,6 @@ static inline ssize_t hfsplus_getxattr(struct dentry *dentry,
 
 ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size);
 
-int hfsplus_removexattr(struct dentry *dentry, const char *name);
-
 int hfsplus_init_security(struct inode *inode, struct inode *dir,
 				const struct qstr *qstr);
 



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

* [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (20 preceding siblings ...)
  2013-12-20 13:16 ` [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr Christoph Hellwig
@ 2013-12-23 16:57 ` Chris Mason
  2013-12-23 17:01   ` hch
  2014-01-07 15:53 ` Christoph Hellwig
  22 siblings, 1 reply; 30+ messages in thread
From: Chris Mason @ 2013-12-23 16:57 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Fri, 2013-12-20 at 05:16 -0800, Christoph Hellwig wrote:
> This series consolidates the various cut'n'pasted Posix ACL implementations
> into a single common one based on the ->get_acl method Linus added a while
> ago and a new ->set_acl counterpart.
> 
> This remove ~1800 lines of code and provides a single place to implement
> various nasty little gems of the semantics.

Is this in a git tree somewhere?  I'll pull in and test the btrfs bits.

-chris




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

* [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3
  2013-12-23 16:57 ` [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Chris Mason
@ 2013-12-23 17:01   ` hch
  0 siblings, 0 replies; 30+ messages in thread
From: hch @ 2013-12-23 17:01 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Mon, Dec 23, 2013 at 04:57:58PM +0000, Chris Mason wrote:
> On Fri, 2013-12-20 at 05:16 -0800, Christoph Hellwig wrote:
> > This series consolidates the various cut'n'pasted Posix ACL implementations
> > into a single common one based on the ->get_acl method Linus added a while
> > ago and a new ->set_acl counterpart.
> > 
> > This remove ~1800 lines of code and provides a single place to implement
> > various nasty little gems of the semantics.
> 
> Is this in a git tree somewhere?

Only on my box.  Given how shitty kernel.org is to use these days I
don't bother with it anymore.



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

* [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr
  2013-12-23 14:37         ` Christoph Hellwig
@ 2013-12-24  6:41           ` Vyacheslav Dubeyko
  0 siblings, 0 replies; 30+ messages in thread
From: Vyacheslav Dubeyko @ 2013-12-24  6:41 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Mon, 2013-12-23 at 06:37 -0800, Christoph Hellwig wrote:
> On Mon, Dec 23, 2013 at 10:40:09AM +0400, Vyacheslav Dubeyko wrote:
> > Maybe I missed something, but I can see that this check is removed only.
> > Could you point out the code in your patch that it checks and forbids
> > such combination as "osx.security.*", "osx.trusted.*" and so on?
> 
> @@ -941,6 +857,9 @@ static int hfsplus_osx_setxattr(struct dentry
> *dentry, const char *name,
>         if (len > HFSPLUS_ATTR_MAX_STRLEN)
> 		return -EOPNOTSUPP;
> 
> +       if (is_known_namespace(name))
> +               return -EOPNOTSUPP;
> +
> 

Yes, now I've realized your approach. You are right. It's my
misunderstanding. So, comments are really necessary for describing the
goal of this check. Thank you for adding it in the last version of
reworked patch.

> 
> > So, if it needs to use xattr handler only for removing then it needs to
> > make some refactoring of using __hfsplus_setxattr() and
> > hfsplus_removexattr() or merging these two functions into one. And I
> > think that merging is better idea.
> 
> I've not done the full merge, but below is an updated patch to make
> sure hfsplus uses the handlers for the remove case, and making sure
> the adding/striping of the prefix for the osv handlers is more
> transparent:
> 

As far as I can judge, changing from hfsplus_removexattr() to
generic_removexattr() is made correctly.

> diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
> index 9ee6298..bdec665 100644
> --- a/fs/hfsplus/dir.c
> +++ b/fs/hfsplus/dir.c
> @@ -529,7 +529,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
>  	.setxattr		= generic_setxattr,
>  	.getxattr		= generic_getxattr,
>  	.listxattr		= hfsplus_listxattr,
> -	.removexattr		= hfsplus_removexattr,
> +	.removexattr		= generic_removexattr,
>  #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
>  	.get_acl		= hfsplus_get_posix_acl,
>  	.set_acl		= hfsplus_set_posix_acl,
> diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
> index 2e10993..83c9166 100644
> --- a/fs/hfsplus/inode.c
> +++ b/fs/hfsplus/inode.c
> @@ -390,7 +390,7 @@ static const struct inode_operations hfsplus_file_inode_operations = {
>  	.setxattr	= generic_setxattr,
>  	.getxattr	= generic_getxattr,
>  	.listxattr	= hfsplus_listxattr,
> -	.removexattr	= hfsplus_removexattr,
> +	.removexattr	= generic_removexattr,
>  #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
>  	.get_acl	= hfsplus_get_posix_acl,
>  	.set_acl	= hfsplus_set_posix_acl,
> diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
> index bf88baa..c838b84 100644
> --- a/fs/hfsplus/xattr.c
> +++ b/fs/hfsplus/xattr.c
> @@ -11,6 +11,8 @@
>  #include "xattr.h"
>  #include "acl.h"
>  
> +static int hfsplus_removexattr(struct inode *inode, const char *name);
> +
>  const struct xattr_handler *hfsplus_xattr_handlers[] = {
>  	&hfsplus_xattr_osx_handler,
>  	&hfsplus_xattr_user_handler,
> @@ -52,82 +54,6 @@ static inline int is_known_namespace(const char *name)
>  	return true;
>  }
>  
> -static int can_set_system_xattr(struct inode *inode, const char *name,
> -				const void *value, size_t size)
> -{
> -#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
> -	struct posix_acl *acl;
> -	int err;
> -
> -	if (!inode_owner_or_capable(inode))
> -		return -EPERM;
> -
> -	/*
> -	 * POSIX_ACL_XATTR_ACCESS is tied to i_mode
> -	 */
> -	if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) {
> -		acl = posix_acl_from_xattr(&init_user_ns, value, size);
> -		if (IS_ERR(acl))
> -			return PTR_ERR(acl);
> -		if (acl) {
> -			err = posix_acl_equiv_mode(acl, &inode->i_mode);
> -			posix_acl_release(acl);
> -			if (err < 0)
> -				return err;
> -			mark_inode_dirty(inode);
> -		}
> -		/*
> -		 * We're changing the ACL.  Get rid of the cached one
> -		 */
> -		forget_cached_acl(inode, ACL_TYPE_ACCESS);
> -
> -		return 0;
> -	} else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) {
> -		acl = posix_acl_from_xattr(&init_user_ns, value, size);
> -		if (IS_ERR(acl))
> -			return PTR_ERR(acl);
> -		posix_acl_release(acl);
> -
> -		/*
> -		 * We're changing the default ACL.  Get rid of the cached one
> -		 */
> -		forget_cached_acl(inode, ACL_TYPE_DEFAULT);
> -
> -		return 0;
> -	}
> -#endif /* CONFIG_HFSPLUS_FS_POSIX_ACL */
> -	return -EOPNOTSUPP;
> -}
> -
> -static int can_set_xattr(struct inode *inode, const char *name,
> -				const void *value, size_t value_len)
> -{
> -	if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
> -		return can_set_system_xattr(inode, name, value, value_len);
> -
> -	if (!strncmp(name, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN)) {
> -		/*
> -		 * This makes sure that we aren't trying to set an
> -		 * attribute in a different namespace by prefixing it
> -		 * with "osx."
> -		 */
> -		if (is_known_namespace(name + XATTR_MAC_OSX_PREFIX_LEN))
> -			return -EOPNOTSUPP;
> -
> -		return 0;
> -	}
> -
> -	/*
> -	 * Don't allow setting an attribute in an unknown namespace.
> -	 */
> -	if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
> -	    strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) &&
> -	    strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
> -		return -EOPNOTSUPP;
> -
> -	return 0;
> -}
> -
>  static void hfsplus_init_header_node(struct inode *attr_file,
>  					u32 clump_size,
>  					char *buf, u16 node_size)
> @@ -350,18 +276,8 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
>  				HFSPLUS_IS_RSRC(inode))
>  		return -EOPNOTSUPP;
>  
> -	err = can_set_xattr(inode, name, value, size);
> -	if (err)
> -		return err;
> -
> -	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
> -				XATTR_MAC_OSX_PREFIX_LEN) == 0)
> -		name += XATTR_MAC_OSX_PREFIX_LEN;

Removing this skipping of virtual "osx." prefix means that you save it
on volume. But such action means volume corruption really. Because HFS+
volume hasn't such prefixes for xattrs in AttributesFile. Usually,
special xattrs has prefix "com.apple.*" but others haven't any prefix
and can be named as you want. So, I think that it is not correct
modification.

> -
> -	if (value == NULL) {
> -		value = "";
> -		size = 0;
> -	}
> +	if (value == NULL)
> +		return hfsplus_removexattr(inode, name);
>  
>  	err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &cat_fd);
>  	if (err) {
> @@ -577,18 +493,6 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
>  				HFSPLUS_IS_RSRC(inode))
>  		return -EOPNOTSUPP;
>  
> -	if (strncmp(name, XATTR_MAC_OSX_PREFIX,
> -				XATTR_MAC_OSX_PREFIX_LEN) == 0) {
> -		/* skip "osx." prefix */
> -		name += XATTR_MAC_OSX_PREFIX_LEN;

Ditto. This skipping is made because virtual prefix was added by user or
on listxattr phase. But we should use for searching on a volume the name
without "osx." prefix. Otherwise, how do you get
"com.apple.system.Security" xattr from volume, for example? You will
search "osx.com.apple.system.Security" that doesn't exist on HFS+
volume.

Thanks,
Vyacheslav Dubeyko.




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

* [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3
  2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
                   ` (21 preceding siblings ...)
  2013-12-23 16:57 ` [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Chris Mason
@ 2014-01-07 15:53 ` Christoph Hellwig
  22 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2014-01-07 15:53 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Fri, Dec 20, 2013 at 05:16:35AM -0800, Christoph Hellwig wrote:
> This series consolidates the various cut'n'pasted Posix ACL implementations
> into a single common one based on the ->get_acl method Linus added a while
> ago and a new ->set_acl counterpart.
> 
> This remove ~1800 lines of code and provides a single place to implement
> various nasty little gems of the semantics.

Any more comments?  Al, what's the best way to make sure this doesn't
miss 3.14?



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

end of thread, other threads:[~2014-01-07 15:53 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 13:16 [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 01/21] reiserfs: prefix ACL symbols with reiserfs_ Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 02/21] fs: merge xattr_acl.c into posix_acl.c Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 03/21] fs: add get_acl helper Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 04/21] fs: add a set_acl inode operation Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 05/21] fs: add generic xattr_acl handlers Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 06/21] fs: make posix_acl_chmod more useful Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 07/21] fs: make posix_acl_create " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 08/21] btrfs: use generic posix ACL infrastructure Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 09/21] ext2/3/4: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 10/21] f2fs: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 11/21] hfsplus: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 12/21] jffs2: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 13/21] ocfs2: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 14/21] reiserfs: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 15/21] xfs: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 16/21] jfs: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 17/21] gfs2: " Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 18/21] nfs: use generic posix ACL infrastructure for v3 Posix ACLs Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 19/21] fs: remove generic_acl Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 20/21] nfsd: use get_acl and ->set_acl Christoph Hellwig
2013-12-20 13:16 ` [Cluster-devel] [PATCH 21/21] hfsplus: remove can_set_xattr Christoph Hellwig
2013-12-21 17:07   ` Vyacheslav Dubeyko
2013-12-22 19:28     ` Christoph Hellwig
2013-12-23  6:40       ` Vyacheslav Dubeyko
2013-12-23 14:37         ` Christoph Hellwig
2013-12-24  6:41           ` Vyacheslav Dubeyko
2013-12-23 16:57 ` [Cluster-devel] [PATCH 00/21] Consolidate Posix ACL implementation V3 Chris Mason
2013-12-23 17:01   ` hch
2014-01-07 15:53 ` 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).