Skip to content

Commit 9db8985

Browse files
committed
Merge tag 'vfs/v6.4-rc3/misc.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fixes from Christian Brauner: - During the acl rework we merged this cycle the generic_listxattr() helper had to be modified in a way that in principle it would allow for POSIX ACLs to be reported. At least that was the impression we had initially. Because before the acl rework POSIX ACLs would be reported if the filesystem did have POSIX ACL xattr handlers in sb->s_xattr. That logic changed and now we can simply check whether the superblock has SB_POSIXACL set and if the inode has inode->i_{default_}acl set report the appropriate POSIX ACL name. However, we didn't realize that generic_listxattr() was only ever used by two filesystems. Both of them don't support POSIX ACLs via sb->s_xattr handlers and so never reported POSIX ACLs via generic_listxattr() even if they raised SB_POSIXACL and did contain inodes which had acls set. The example here is nfs4. As a result, generic_listxattr() suddenly started reporting POSIX ACLs when it wouldn't have before. Since SB_POSIXACL implies that the umask isn't stripped in the VFS nfs4 can't just drop SB_POSIXACL from the superblock as it would also alter umask handling for them. So just have generic_listxattr() not report POSIX ACLs as it never did anyway. It's documented as such. - Our SB_* flags currently use a signed integer and we shift the last bit causing UBSAN to complain about undefined behavior. Switch to using unsigned. While the original patch used an explicit unsigned bitshift it's now pretty common to rely on the BIT() macro in a lot of headers nowadays. So the patch has been adjusted to use that. - Add Namjae as ntfs reviewer. They're already active this cycle so let's make it explicit right now. * tag 'vfs/v6.4-rc3/misc.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: ntfs: Add myself as a reviewer fs: don't call posix_acl_listxattr in generic_listxattr fs: fix undefined behavior in bit shift for SB_NOUSER
2 parents 50fb587 + 4852446 commit 9db8985

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14927,6 +14927,7 @@ F: drivers/ntb/hw/intel/
1492714927

1492814928
NTFS FILESYSTEM
1492914929
M: Anton Altaparmakov <[email protected]>
14930+
R: Namjae Jeon <[email protected]>
1493014931
1493114932
S: Supported
1493214933
W: http://www.tuxera.com/

fs/xattr.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,16 @@ int xattr_list_one(char **buffer, ssize_t *remaining_size, const char *name)
985985
return 0;
986986
}
987987

988-
/*
988+
/**
989+
* generic_listxattr - run through a dentry's xattr list() operations
990+
* @dentry: dentry to list the xattrs
991+
* @buffer: result buffer
992+
* @buffer_size: size of @buffer
993+
*
989994
* Combine the results of the list() operation from every xattr_handler in the
990-
* list.
995+
* xattr_handler stack.
996+
*
997+
* Note that this will not include the entries for POSIX ACLs.
991998
*/
992999
ssize_t
9931000
generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
@@ -996,10 +1003,6 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
9961003
ssize_t remaining_size = buffer_size;
9971004
int err = 0;
9981005

999-
err = posix_acl_listxattr(d_inode(dentry), &buffer, &remaining_size);
1000-
if (err)
1001-
return err;
1002-
10031006
for_each_xattr_handler(handlers, handler) {
10041007
if (!handler->name || (handler->list && !handler->list(dentry)))
10051008
continue;

include/linux/fs.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,29 +1076,29 @@ extern int send_sigurg(struct fown_struct *fown);
10761076
* sb->s_flags. Note that these mirror the equivalent MS_* flags where
10771077
* represented in both.
10781078
*/
1079-
#define SB_RDONLY 1 /* Mount read-only */
1080-
#define SB_NOSUID 2 /* Ignore suid and sgid bits */
1081-
#define SB_NODEV 4 /* Disallow access to device special files */
1082-
#define SB_NOEXEC 8 /* Disallow program execution */
1083-
#define SB_SYNCHRONOUS 16 /* Writes are synced at once */
1084-
#define SB_MANDLOCK 64 /* Allow mandatory locks on an FS */
1085-
#define SB_DIRSYNC 128 /* Directory modifications are synchronous */
1086-
#define SB_NOATIME 1024 /* Do not update access times. */
1087-
#define SB_NODIRATIME 2048 /* Do not update directory access times */
1088-
#define SB_SILENT 32768
1089-
#define SB_POSIXACL (1<<16) /* VFS does not apply the umask */
1090-
#define SB_INLINECRYPT (1<<17) /* Use blk-crypto for encrypted files */
1091-
#define SB_KERNMOUNT (1<<22) /* this is a kern_mount call */
1092-
#define SB_I_VERSION (1<<23) /* Update inode I_version field */
1093-
#define SB_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
1079+
#define SB_RDONLY BIT(0) /* Mount read-only */
1080+
#define SB_NOSUID BIT(1) /* Ignore suid and sgid bits */
1081+
#define SB_NODEV BIT(2) /* Disallow access to device special files */
1082+
#define SB_NOEXEC BIT(3) /* Disallow program execution */
1083+
#define SB_SYNCHRONOUS BIT(4) /* Writes are synced at once */
1084+
#define SB_MANDLOCK BIT(6) /* Allow mandatory locks on an FS */
1085+
#define SB_DIRSYNC BIT(7) /* Directory modifications are synchronous */
1086+
#define SB_NOATIME BIT(10) /* Do not update access times. */
1087+
#define SB_NODIRATIME BIT(11) /* Do not update directory access times */
1088+
#define SB_SILENT BIT(15)
1089+
#define SB_POSIXACL BIT(16) /* VFS does not apply the umask */
1090+
#define SB_INLINECRYPT BIT(17) /* Use blk-crypto for encrypted files */
1091+
#define SB_KERNMOUNT BIT(22) /* this is a kern_mount call */
1092+
#define SB_I_VERSION BIT(23) /* Update inode I_version field */
1093+
#define SB_LAZYTIME BIT(25) /* Update the on-disk [acm]times lazily */
10941094

10951095
/* These sb flags are internal to the kernel */
1096-
#define SB_SUBMOUNT (1<<26)
1097-
#define SB_FORCE (1<<27)
1098-
#define SB_NOSEC (1<<28)
1099-
#define SB_BORN (1<<29)
1100-
#define SB_ACTIVE (1<<30)
1101-
#define SB_NOUSER (1<<31)
1096+
#define SB_SUBMOUNT BIT(26)
1097+
#define SB_FORCE BIT(27)
1098+
#define SB_NOSEC BIT(28)
1099+
#define SB_BORN BIT(29)
1100+
#define SB_ACTIVE BIT(30)
1101+
#define SB_NOUSER BIT(31)
11021102

11031103
/* These flags relate to encoding and casefolding */
11041104
#define SB_ENC_STRICT_MODE_FL (1 << 0)

0 commit comments

Comments
 (0)