Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hfsplus: drop ACL support

The HFS+ Access Control Lists have not worked at all for the past five
years, and nobody seems to have noticed. Besides, POSIX draft ACLs are
not compatible with MacOS. Drop the feature entirely.

Link: http://lkml.kernel.org/r/20180714190608.wtnmmtjqeyladkut@eaf
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ernesto A. Fernández and committed by
Linus Torvalds
f168d9fd afd6c9e1

+4 -232
-15
fs/hfsplus/Kconfig
··· 11 11 MacOS 8. It includes all Mac specific filesystem data such as 12 12 data forks and creator codes, but it also has several UNIX 13 13 style features such as file ownership and permissions. 14 - 15 - config HFSPLUS_FS_POSIX_ACL 16 - bool "HFS+ POSIX Access Control Lists" 17 - depends on HFSPLUS_FS 18 - select FS_POSIX_ACL 19 - help 20 - POSIX Access Control Lists (ACLs) support permissions for users and 21 - groups beyond the owner/group/world scheme. 22 - 23 - It needs to understand that POSIX ACLs are treated only under 24 - Linux. POSIX ACLs doesn't mean something under Mac OS X. 25 - Mac OS X beginning with version 10.4 ("Tiger") support NFSv4 ACLs, 26 - which are part of the NFSv4 standard. 27 - 28 - If you don't know what Access Control Lists are, say N
-2
fs/hfsplus/Makefile
··· 8 8 hfsplus-objs := super.o options.o inode.o ioctl.o extents.o catalog.o dir.o btree.o \ 9 9 bnode.o brec.o bfind.o tables.o unicode.o wrapper.o bitmap.o part_tbl.o \ 10 10 attributes.o xattr.o xattr_user.o xattr_security.o xattr_trusted.o 11 - 12 - hfsplus-$(CONFIG_HFSPLUS_FS_POSIX_ACL) += posix_acl.o
-28
fs/hfsplus/acl.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * linux/fs/hfsplus/acl.h 4 - * 5 - * Vyacheslav Dubeyko <slava@dubeyko.com> 6 - * 7 - * Handler for Posix Access Control Lists (ACLs) support. 8 - */ 9 - 10 - #include <linux/posix_acl_xattr.h> 11 - 12 - #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL 13 - 14 - /* posix_acl.c */ 15 - struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type); 16 - int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, 17 - int type); 18 - extern int hfsplus_init_posix_acl(struct inode *, struct inode *); 19 - 20 - #else /* CONFIG_HFSPLUS_FS_POSIX_ACL */ 21 - #define hfsplus_get_posix_acl NULL 22 - #define hfsplus_set_posix_acl NULL 23 - 24 - static inline int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir) 25 - { 26 - return 0; 27 - } 28 - #endif /* CONFIG_HFSPLUS_FS_POSIX_ACL */
+2 -7
fs/hfsplus/dir.c
··· 18 18 #include "hfsplus_fs.h" 19 19 #include "hfsplus_raw.h" 20 20 #include "xattr.h" 21 - #include "acl.h" 22 21 23 22 static inline void hfsplus_instantiate(struct dentry *dentry, 24 23 struct inode *inode, u32 cnid) ··· 454 455 if (res) 455 456 goto out_err; 456 457 457 - res = hfsplus_init_inode_security(inode, dir, &dentry->d_name); 458 + res = hfsplus_init_security(inode, dir, &dentry->d_name); 458 459 if (res == -EOPNOTSUPP) 459 460 res = 0; /* Operation is not supported. */ 460 461 else if (res) { ··· 495 496 if (res) 496 497 goto failed_mknod; 497 498 498 - res = hfsplus_init_inode_security(inode, dir, &dentry->d_name); 499 + res = hfsplus_init_security(inode, dir, &dentry->d_name); 499 500 if (res == -EOPNOTSUPP) 500 501 res = 0; /* Operation is not supported. */ 501 502 else if (res) { ··· 566 567 .mknod = hfsplus_mknod, 567 568 .rename = hfsplus_rename, 568 569 .listxattr = hfsplus_listxattr, 569 - #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL 570 - .get_acl = hfsplus_get_posix_acl, 571 - .set_acl = hfsplus_set_posix_acl, 572 - #endif 573 570 }; 574 571 575 572 const struct file_operations hfsplus_dir_operations = {
-1
fs/hfsplus/hfsplus_fs.h
··· 31 31 #define DBG_EXTENT 0x00000020 32 32 #define DBG_BITMAP 0x00000040 33 33 #define DBG_ATTR_MOD 0x00000080 34 - #define DBG_ACL_MOD 0x00000100 35 34 36 35 #if 0 37 36 #define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD)
-11
fs/hfsplus/inode.c
··· 21 21 #include "hfsplus_fs.h" 22 22 #include "hfsplus_raw.h" 23 23 #include "xattr.h" 24 - #include "acl.h" 25 24 26 25 static int hfsplus_readpage(struct file *file, struct page *page) 27 26 { ··· 266 267 setattr_copy(inode, attr); 267 268 mark_inode_dirty(inode); 268 269 269 - if (attr->ia_valid & ATTR_MODE) { 270 - error = posix_acl_chmod(inode, inode->i_mode); 271 - if (unlikely(error)) 272 - return error; 273 - } 274 - 275 270 return 0; 276 271 } 277 272 ··· 329 336 static const struct inode_operations hfsplus_file_inode_operations = { 330 337 .setattr = hfsplus_setattr, 331 338 .listxattr = hfsplus_listxattr, 332 - #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL 333 - .get_acl = hfsplus_get_posix_acl, 334 - .set_acl = hfsplus_set_posix_acl, 335 - #endif 336 339 }; 337 340 338 341 static const struct file_operations hfsplus_file_operations = {
-144
fs/hfsplus/posix_acl.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/fs/hfsplus/posix_acl.c 4 - * 5 - * Vyacheslav Dubeyko <slava@dubeyko.com> 6 - * 7 - * Handler for Posix Access Control Lists (ACLs) support. 8 - */ 9 - 10 - #include "hfsplus_fs.h" 11 - #include "xattr.h" 12 - #include "acl.h" 13 - 14 - struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type) 15 - { 16 - struct posix_acl *acl; 17 - char *xattr_name; 18 - char *value = NULL; 19 - ssize_t size; 20 - 21 - hfs_dbg(ACL_MOD, "[%s]: ino %lu\n", __func__, inode->i_ino); 22 - 23 - switch (type) { 24 - case ACL_TYPE_ACCESS: 25 - xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; 26 - break; 27 - case ACL_TYPE_DEFAULT: 28 - xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT; 29 - break; 30 - default: 31 - return ERR_PTR(-EINVAL); 32 - } 33 - 34 - size = __hfsplus_getxattr(inode, xattr_name, NULL, 0); 35 - 36 - if (size > 0) { 37 - value = (char *)hfsplus_alloc_attr_entry(); 38 - if (unlikely(!value)) 39 - return ERR_PTR(-ENOMEM); 40 - size = __hfsplus_getxattr(inode, xattr_name, value, size); 41 - } 42 - 43 - if (size > 0) 44 - acl = posix_acl_from_xattr(&init_user_ns, value, size); 45 - else if (size == -ENODATA) 46 - acl = NULL; 47 - else 48 - acl = ERR_PTR(size); 49 - 50 - hfsplus_destroy_attr_entry((hfsplus_attr_entry *)value); 51 - 52 - return acl; 53 - } 54 - 55 - static int __hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, 56 - int type) 57 - { 58 - int err; 59 - char *xattr_name; 60 - size_t size = 0; 61 - char *value = NULL; 62 - 63 - hfs_dbg(ACL_MOD, "[%s]: ino %lu\n", __func__, inode->i_ino); 64 - 65 - switch (type) { 66 - case ACL_TYPE_ACCESS: 67 - xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; 68 - break; 69 - 70 - case ACL_TYPE_DEFAULT: 71 - xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT; 72 - if (!S_ISDIR(inode->i_mode)) 73 - return acl ? -EACCES : 0; 74 - break; 75 - 76 - default: 77 - return -EINVAL; 78 - } 79 - 80 - if (acl) { 81 - size = posix_acl_xattr_size(acl->a_count); 82 - if (unlikely(size > HFSPLUS_MAX_INLINE_DATA_SIZE)) 83 - return -ENOMEM; 84 - value = (char *)hfsplus_alloc_attr_entry(); 85 - if (unlikely(!value)) 86 - return -ENOMEM; 87 - err = posix_acl_to_xattr(&init_user_ns, acl, value, size); 88 - if (unlikely(err < 0)) 89 - goto end_set_acl; 90 - } 91 - 92 - err = __hfsplus_setxattr(inode, xattr_name, value, size, 0); 93 - 94 - end_set_acl: 95 - hfsplus_destroy_attr_entry((hfsplus_attr_entry *)value); 96 - 97 - if (!err) 98 - set_cached_acl(inode, type, acl); 99 - 100 - return err; 101 - } 102 - 103 - int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, int type) 104 - { 105 - int err; 106 - 107 - if (type == ACL_TYPE_ACCESS && acl) { 108 - err = posix_acl_update_mode(inode, &inode->i_mode, &acl); 109 - if (err) 110 - return err; 111 - } 112 - return __hfsplus_set_posix_acl(inode, acl, type); 113 - } 114 - 115 - int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir) 116 - { 117 - int err = 0; 118 - struct posix_acl *default_acl, *acl; 119 - 120 - hfs_dbg(ACL_MOD, 121 - "[%s]: ino %lu, dir->ino %lu\n", 122 - __func__, inode->i_ino, dir->i_ino); 123 - 124 - if (S_ISLNK(inode->i_mode)) 125 - return 0; 126 - 127 - err = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); 128 - if (err) 129 - return err; 130 - 131 - if (default_acl) { 132 - err = __hfsplus_set_posix_acl(inode, default_acl, 133 - ACL_TYPE_DEFAULT); 134 - posix_acl_release(default_acl); 135 - } 136 - 137 - if (acl) { 138 - if (!err) 139 - err = __hfsplus_set_posix_acl(inode, acl, 140 - ACL_TYPE_ACCESS); 141 - posix_acl_release(acl); 142 - } 143 - return err; 144 - }
+2 -2
fs/hfsplus/super.c
··· 564 564 goto out_put_hidden_dir; 565 565 } 566 566 567 - err = hfsplus_init_inode_security(sbi->hidden_dir, 568 - root, &str); 567 + err = hfsplus_init_security(sbi->hidden_dir, 568 + root, &str); 569 569 if (err == -EOPNOTSUPP) 570 570 err = 0; /* Operation is not supported. */ 571 571 else if (err) {
-6
fs/hfsplus/xattr.c
··· 8 8 */ 9 9 10 10 #include "hfsplus_fs.h" 11 - #include <linux/posix_acl_xattr.h> 12 11 #include <linux/nls.h> 13 12 #include "xattr.h" 14 - #include "acl.h" 15 13 16 14 static int hfsplus_removexattr(struct inode *inode, const char *name); 17 15 ··· 17 19 &hfsplus_xattr_osx_handler, 18 20 &hfsplus_xattr_user_handler, 19 21 &hfsplus_xattr_trusted_handler, 20 - #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL 21 - &posix_acl_access_xattr_handler, 22 - &posix_acl_default_xattr_handler, 23 - #endif 24 22 &hfsplus_xattr_security_handler, 25 23 NULL 26 24 };
-3
fs/hfsplus/xattr.h
··· 38 38 int hfsplus_init_security(struct inode *inode, struct inode *dir, 39 39 const struct qstr *qstr); 40 40 41 - int hfsplus_init_inode_security(struct inode *inode, struct inode *dir, 42 - const struct qstr *qstr); 43 - 44 41 #endif
-13
fs/hfsplus/xattr_security.c
··· 12 12 13 13 #include "hfsplus_fs.h" 14 14 #include "xattr.h" 15 - #include "acl.h" 16 15 17 16 static int hfsplus_security_getxattr(const struct xattr_handler *handler, 18 17 struct dentry *unused, struct inode *inode, ··· 69 70 { 70 71 return security_inode_init_security(inode, dir, qstr, 71 72 &hfsplus_initxattrs, NULL); 72 - } 73 - 74 - int hfsplus_init_inode_security(struct inode *inode, 75 - struct inode *dir, 76 - const struct qstr *qstr) 77 - { 78 - int err; 79 - 80 - err = hfsplus_init_posix_acl(inode, dir); 81 - if (!err) 82 - err = hfsplus_init_security(inode, dir, qstr); 83 - return err; 84 73 } 85 74 86 75 const struct xattr_handler hfsplus_xattr_security_handler = {