fs: introduce file_getattr and file_setattr syscalls
v5 cover fs: introduce file_getattr and file_setattr syscalls
This patchset introduced two new syscalls file_getattr() and file_setattr(). These syscalls are similar to FS_IOC_FSSETXATTR ioctl() except they use *at() semantics. Therefore, there's no need to open the file to get a fd.
These syscalls allow userspace to set filesystem inode attributes on special files. One of the usage examples is XFS quota projects.
XFS has project quotas which could be attached to a directory. All new inodes in these directories inherit project ID set on parent directory.
The project is created from userspace by opening and calling FS_IOC_FSSETXATTR on each inode. This is not possible for special files such as FIFO, SOCK, BLK etc. Therefore, some inodes are left with empty project ID. Those inodes then are not shown in the quota accounting but still exist in the directory. This is not critical but in the case when special files are created in the directory with already existing project quota, these new inodes inherit extended attributes. This creates a mix of special files with and without attributes. Moreover, special files with attributes don't have a possibility to become clear or change the attributes. This, in turn, prevents userspace from re-creating quota project on these existing files.
NAME
file_getattr/file_setattr - get/set filesystem inode attributes
SYNOPSIS
#include <sys/syscall.h> /* Definition of SYS_* constants */ #include <unistd.h> long syscall(SYS_file_getattr, int dirfd, const char *pathname, struct fsxattr *fsx, size_t size, unsigned int at_flags); long syscall(SYS_file_setattr, int dirfd, const char *pathname, struct fsxattr *fsx, size_t size, unsigned int at_flags); Note: glibc doesn't provide for file_getattr()/file_setattr(), use syscall(2) instead.
DESCRIPTION
The syscalls take fd and path. If path is absolute, fd is not used. If path is empty, fd can be AT_FDCWD or any valid fd which will be used to get/set attributes on.
This is an alternative to FS_IOC_FSGETXATTR/FS_IOC_FSSETXATTR ioctl with a difference that file don't need to be open as we can reference it with a path instead of fd. By having this we can manipulated filesystem inode attributes not only on regular files but also on special ones. This is not possible with FS_IOC_FSSETXATTR ioctl as with special files we can not call ioctl() directly on the filesystem inode using file descriptor.
at_flags can be set to AT_SYMLINK_NOFOLLOW or AT_EMPTY_PATH.
RETURN VALUE
On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.
ERRORS
EINVAL Invalid at_flag specified (only
AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH is supported).
EINVAL Size was smaller than any known version of
struct fsxattr.
EINVAL Invalid combination of parameters provided in
fsxattr for this type of file.
E2BIG Size of input argument **struct fsxattr** is too
big.
EBADF Invalid file descriptor was provided.
EPERM No permission to change this file.
EOPNOTSUPP Filesystem does not support setting attributes
on this type of inode
HISTORY
Added in Linux 6.15.
EXAMPLE
Create directory and file "mkdir ./dir && touch ./dir/foo" and then execute the following program:
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <linux/fs.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <unistd.h>
int
main(int argc, char **argv) {
int dfd;
int error;
struct fsxattr fsx;
dfd = open("./dir", O_RDONLY);
if (dfd == -1) {
printf("can not open ./dir");
return dfd;
}
error = syscall(467, dfd, "./foo", &fsx, 0);
if (error) {
printf("can not call 467: %s", strerror(errno));
return error;
}
printf("dir/foo flags: %d\n", fsx.fsx_xflags);
fsx.fsx_xflags |= FS_XFLAG_NODUMP;
error = syscall(468, dfd, "./foo", &fsx, 0);
if (error) {
printf("can not call 468: %s", strerror(errno));
return error;
}
printf("dir/foo flags: %d\n", fsx.fsx_xflags);
return error;
}SEE ALSO
ioctl(2), ioctl_iflags(2), ioctl_xfs_fsgetxattr(2)
---
Changes in v5:
- Remove setting of LOOKUP_EMPTY flags which does not have any effect
- Return -ENOSUPP from vfs_fileattr_set()
- Add fsxattr masking (by Amir)
- Fix UAF issue dentry
- Fix getname_maybe_null() issue with NULL path
- Implement file_getattr/file_setattr hooks
- Return LSM return code from file_setattr
- Rename from getfsxattrat/setfsxattrat to file_getattr/file_setattr
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Use getname_maybe_null() for correct handling of dfd + path semantic
- Remove restriction for special files on which flags are allowed
- Utilize copy_struct_from_user() for better future compatibility
- Add draft man page to cover letter
- Convert -ENOIOCTLCMD to -EOPNOSUPP as more appropriate for syscall
- Add missing __user to header declaration of syscalls
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Remove unnecessary "dfd is dir" check as it checked in user_path_at()
- Remove unnecessary "same filesystem" check
- Use CLASS() instead of directly calling fdget/fdput
- Link to v2: https://lore.kernel.org/r/[email protected]
v1:
https://lore.kernel.org/linuxppc-dev/[email protected]/
Previous discussion:
https://lore.kernel.org/linux-xfs/[email protected]/
---
Amir Goldstein (1):
fs: prepare for extending file_get/setattr()
Andrey Albershteyn (6):
fs: split fileattr related helpers into separate file
lsm: introduce new hooks for setting/getting inode fsxattr
selinux: implement inode_file_[g|s]etattr hooks
fs: split fileattr/fsxattr converters into helpers
fs: make vfs_fileattr_[get|set] return -EOPNOSUPP
fs: introduce file_getattr and file_setattr syscalls
arch/alpha/kernel/syscalls/syscall.tbl | 2 + arch/arm/tools/syscall.tbl | 2 + arch/arm64/tools/syscall_32.tbl | 2 + arch/m68k/kernel/syscalls/syscall.tbl | 2 + arch/microblaze/kernel/syscalls/syscall.tbl | 2 + arch/mips/kernel/syscalls/syscall_n32.tbl | 2 + arch/mips/kernel/syscalls/syscall_n64.tbl | 2 + arch/mips/kernel/syscalls/syscall_o32.tbl | 2 + arch/parisc/kernel/syscalls/syscall.tbl | 2 + arch/powerpc/kernel/syscalls/syscall.tbl | 2 + arch/s390/kernel/syscalls/syscall.tbl | 2 + arch/sh/kernel/syscalls/syscall.tbl | 2 + arch/sparc/kernel/syscalls/syscall.tbl | 2 + arch/x86/entry/syscalls/syscall_32.tbl | 2 + arch/x86/entry/syscalls/syscall_64.tbl | 2 + arch/xtensa/kernel/syscalls/syscall.tbl | 2 + fs/Makefile | 3 +- fs/ecryptfs/inode.c | 8 +- fs/file_attr.c | 475 ++++++++++++++++++++++++++++ fs/ioctl.c | 309 ------------------ fs/overlayfs/inode.c | 2 +- include/linux/fileattr.h | 26 ++ include/linux/lsm_hook_defs.h | 2 + include/linux/security.h | 16 + include/linux/syscalls.h | 6 + include/uapi/asm-generic/unistd.h | 8 +- include/uapi/linux/fs.h | 3 + security/security.c | 30 ++ security/selinux/hooks.c | 14 + 29 files changed, 621 insertions(+), 313 deletions(-)
---
base-commit: 0d8d44db295ccad20052d6301ef49ff01fb8ae2d
change-id: 20250114-xattrat-syscall-6a1136d2db59
Best regards,
Signature · 1 line
Andrey Albershteyn <[email protected]>
PATCH v5 1/7 fs: split fileattr related helpers into separate file
From: Andrey Albershteyn <[email protected]>
This patch moves function related to file extended attributes manipulations to separate file. Just refactoring.
--- fs/Makefile | 3 +- fs/file_attr.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++ fs/ioctl.c | 309 --------------------------------------------- include/linux/fileattr.h | 4 + 4 files changed, 324 insertions(+), 310 deletions(-)
fs/Makefile +2 -1
@@ -15,7 +15,8 @@ obj-y := open.o read_write.o file_table.o super.o \ pnode.o splice.o sync.o utimes.o d_path.o \ stack.o fs_struct.o statfs.o fs_pin.o nsfs.o \ fs_types.o fs_context.o fs_parser.o fsopen.o init.o \ - kernel_read_file.o mnt_idmapping.o remap_range.o pidfs.o + kernel_read_file.o mnt_idmapping.o remap_range.o pidfs.o \ + file_attr.o obj-$(CONFIG_BUFFER_HEAD) += buffer.o mpage.o obj-$(CONFIG_PROC_FS) += proc_namespace.o
fs/file_attr.c new file +318 -0
318 lines not on this page · raw message
fs/ioctl.c +0 -309
315 lines not on this page · raw message
include/linux/fileattr.h +4 -0
@@ -55,5 +55,9 @@ static inline bool fileattr_has_fsx(const struct fileattr *fa)int vfs_fileattr_get (struct dentry *dentry,struct fileattr *fa);int vfs_fileattr_set (struct mnt_idmap *idmap,struct dentry *dentry,struct fileattr *fa); +int ioctl_getflags (struct file *file,unsigned int __user *argp); +int ioctl_setflags (struct file *file,unsigned int __user *argp); +int ioctl_fsgetxattr (struct file *file,void __user *argp); +int ioctl_fssetxattr (struct file *file,void __user *argp);#endif /* _LINUX_FILEATTR_H */
Signature · 1 line
2.47.2
PATCH v5 2/7 lsm: introduce new hooks for setting/getting inode fsxattr
In reply to Andrey AlbershteynIntroduce new hooks for setting and getting filesystem extended attributes on inode (FS_IOC_FSGETXATTR).
--- fs/file_attr.c | 19 ++++++++++++++++--- include/linux/lsm_hook_defs.h | 2 ++ include/linux/security.h | 16 ++++++++++++++++ security/security.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 3 deletions(-)
fs/file_attr.c +16 -3
@@ -76,10 +76,15 @@ EXPORT_SYMBOL(fileattr_fill_flags);int vfs_fileattr_get (struct dentry *dentry,struct fileattr *fa) {struct inode *inode =d_inode (dentry); +int error;if (!inode->i_op->fileattr_get)return -ENOIOCTLCMD ; + error =security_inode_file_getattr (dentry, fa); +if (error) +return error; +return inode->i_op->fileattr_get (dentry, fa); }EXPORT_SYMBOL (vfs_fileattr_get);
@@ -242,12 +247,20 @@ int vfs_fileattr_set(struct mnt_idmap *idmap, struct dentry *dentry, }else { fa->flags |= old_ma.flags & ~FS_COMMON_FL ; } + err =fileattr_set_prepare (inode, &old_ma, fa); -if (!err) - err = inode->i_op->fileattr_set (idmap, dentry, fa); +if (err) + goto out; + err =security_inode_file_setattr (dentry, fa); +if (err) + goto out; + err = inode->i_op->fileattr_set (idmap, dentry, fa); +if (err) + goto out; } + +out:inode_unlock (inode); -return err; }EXPORT_SYMBOL (vfs_fileattr_set);
include/linux/lsm_hook_defs.h +2 -0
@@ -157,6 +157,8 @@ LSM_HOOK(int, 0, inode_removexattr, struct mnt_idmap *idmap, struct dentry *dentry, const char *name) LSM_HOOK(void, LSM_RET_VOID, inode_post_removexattr, struct dentry *dentry, const char *name) +LSM_HOOK(int, 0, inode_file_setattr, struct dentry *dentry, struct fileattr *fa) +LSM_HOOK(int, 0, inode_file_getattr, struct dentry *dentry, struct fileattr *fa) LSM_HOOK(int, 0, inode_set_acl, struct mnt_idmap *idmap, struct dentry *dentry, const char *acl_name, struct posix_acl *kacl) LSM_HOOK(void, LSM_RET_VOID, inode_post_set_acl, struct dentry *dentry,
include/linux/security.h +16 -0
@@ -451,6 +451,10 @@ int security_inode_listxattr(struct dentry *dentry);int security_inode_removexattr (struct mnt_idmap *idmap,struct dentry *dentry,const char *name);void security_inode_post_removexattr (struct dentry *dentry,const char *name); +int security_inode_file_setattr (struct dentry *dentry, +struct fileattr *fa); +int security_inode_file_getattr (struct dentry *dentry, +struct fileattr *fa);int security_inode_need_killpriv (struct dentry *dentry);int security_inode_killpriv (struct mnt_idmap *idmap,struct dentry *dentry); int security_inode_getsecurity(struct mnt_idmap *idmap,
@@ -1053,6 +1057,18 @@ static inline void security_inode_post_removexattr(struct dentry *dentry, const char *name) { } +static inline int security_inode_file_setattr (struct dentry *dentry, +struct fileattr *fa) +{ +return 0 ; +} + +static inline int security_inode_file_getattr (struct dentry *dentry, +struct fileattr *fa) +{ +return 0 ; +} +static inline int security_inode_need_killpriv (struct dentry *dentry) {return cap_inode_need_killpriv (dentry);
security/security.c +30 -0
@@ -2622,6 +2622,36 @@ void security_inode_post_removexattr(struct dentry *dentry, const char *name)call_void_hook (inode_post_removexattr, dentry, name); } +/** +* security_inode_file_setattr() - check if setting fsxattr is allowed +* @dentry: file to set filesystem extended attributes on +* @fa: extended attributes to set on the inode +* +* Called when file_setattr() syscall or FS_IOC_FSSETXATTR ioctl() is called on +* inode +* +* Return: Returns 0 if permission is granted. +*/ +int security_inode_file_setattr (struct dentry *dentry,struct fileattr *fa) +{ +return call_int_hook (inode_file_setattr, dentry, fa); +} + +/** +* security_inode_file_getattr() - check if retrieving fsxattr is allowed +* @dentry: file to retrieve filesystem extended attributes from +* @fa: extended attributes to get +* +* Called when file_getattr() syscall or FS_IOC_FSGETXATTR ioctl() is called on +* inode +* +* Return: Returns 0 if permission is granted. +*/ +int security_inode_file_getattr (struct dentry *dentry,struct fileattr *fa) +{ +return call_int_hook (inode_file_getattr, dentry, fa); +} +/** * security_inode_need_killpriv() - Check if security_inode_killpriv() required * @dentry: associated dentry
Signature · 1 line
2.47.2
PATCH v5 3/7 selinux: implement inode_file_[g|s]etattr hooks
In reply to Andrey AlbershteynThese hooks are called on inode extended attribute retrieval/change.
--- security/selinux/hooks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
security/selinux/hooks.c +14 -0
@@ -3366,6 +3366,18 @@ static int selinux_inode_removexattr(struct mnt_idmap *idmap,return -EACCES ; } +static int selinux_inode_file_setattr (struct dentry *dentry, +struct fileattr *fa) +{ +return dentry_has_perm (current_cred (), dentry,FILE__SETATTR ); +} + +static int selinux_inode_file_getattr (struct dentry *dentry, +struct fileattr *fa) +{ +return dentry_has_perm (current_cred (), dentry,FILE__GETATTR ); +} +static int selinux_path_notify (const struct path *path,u64 mask,unsigned int obj_type) {
@@ -7272,6 +7284,8 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (inode_getxattr, selinux_inode_getxattr),LSM_HOOK_INIT (inode_listxattr, selinux_inode_listxattr),LSM_HOOK_INIT (inode_removexattr, selinux_inode_removexattr), +LSM_HOOK_INIT (inode_file_getattr, selinux_inode_file_getattr), +LSM_HOOK_INIT (inode_file_setattr, selinux_inode_file_setattr),LSM_HOOK_INIT (inode_set_acl, selinux_inode_set_acl),LSM_HOOK_INIT (inode_get_acl, selinux_inode_get_acl), LSM_HOOK_INIT(inode_remove_acl, selinux_inode_remove_acl),
Signature · 1 line
2.47.2
PATCH v5 4/7 fs: split fileattr/fsxattr converters into helpers
In reply to Andrey AlbershteynThis will be helpful for file_get/setattr syscalls to convert between fileattr and fsxattr.
--- fs/file_attr.c | 32 +++++++++++++++++++++----------- include/linux/fileattr.h | 2 ++ 2 files changed, 23 insertions(+), 11 deletions(-)
fs/file_attr.c +21 -11
@@ -89,6 +89,16 @@ int vfs_fileattr_get(struct dentry *dentry, struct fileattr *fa) }EXPORT_SYMBOL (vfs_fileattr_get); +void fileattr_to_fsxattr (const struct fileattr *fa,struct fsxattr *fsx) +{ +memset (fsx,0 ,sizeof (struct fsxattr )); + fsx->fsx_xflags = fa->fsx_xflags; + fsx->fsx_extsize = fa->fsx_extsize; + fsx->fsx_nextents = fa->fsx_nextents; + fsx->fsx_projid = fa->fsx_projid; + fsx->fsx_cowextsize = fa->fsx_cowextsize; +} +/** * copy_fsxattr_to_user - copy fsxattr to userspace. * @fa: fileattr pointer
@@ -100,12 +110,7 @@ int copy_fsxattr_to_user(const struct fileattr *fa, struct fsxattr __user *ufa) {struct fsxattr xfa; -memset (&xfa,0 ,sizeof (xfa)); - xfa.fsx_xflags = fa->fsx_xflags; - xfa.fsx_extsize = fa->fsx_extsize; - xfa.fsx_nextents = fa->fsx_nextents; - xfa.fsx_projid = fa->fsx_projid; - xfa.fsx_cowextsize = fa->fsx_cowextsize; +fileattr_to_fsxattr (fa, &xfa);if (copy_to_user (ufa, &xfa,sizeof (xfa)))return -EFAULT ;
@@ -114,6 +119,15 @@ int copy_fsxattr_to_user(const struct fileattr *fa, struct fsxattr __user *ufa) }EXPORT_SYMBOL (copy_fsxattr_to_user); +void fsxattr_to_fileattr (const struct fsxattr *fsx,struct fileattr *fa) +{ +fileattr_fill_xflags (fa, fsx->fsx_xflags); + fa->fsx_extsize = fsx->fsx_extsize; + fa->fsx_nextents = fsx->fsx_nextents; + fa->fsx_projid = fsx->fsx_projid; + fa->fsx_cowextsize = fsx->fsx_cowextsize; +} +static int copy_fsxattr_from_user (struct fileattr *fa,struct fsxattr __user *ufa) {
@@ -122,11 +136,7 @@ static int copy_fsxattr_from_user(struct fileattr *fa,if (copy_from_user (&xfa, ufa,sizeof (xfa)))return -EFAULT ; -fileattr_fill_xflags (fa, xfa.fsx_xflags); - fa->fsx_extsize = xfa.fsx_extsize; - fa->fsx_nextents = xfa.fsx_nextents; - fa->fsx_projid = xfa.fsx_projid; - fa->fsx_cowextsize = xfa.fsx_cowextsize; +fsxattr_to_fileattr (&xfa, fa);return 0 ; }
include/linux/fileattr.h +2 -0
@@ -33,7 +33,9 @@ struct fileattr { bool fsx_valid:1; }; +void fileattr_to_fsxattr (const struct fileattr *fa,struct fsxattr *fsx);int copy_fsxattr_to_user (const struct fileattr *fa,struct fsxattr __user *ufa); +void fsxattr_to_fileattr (const struct fsxattr *fsx,struct fileattr *fa);void fileattr_fill_xflags (struct fileattr *fa,u32 xflags);void fileattr_fill_flags (struct fileattr *fa,u32 flags);
Signature · 1 line
2.47.2
Quoted 212 lines · Andrey Albershteyn
This patchset introduced two new syscalls
file_getattr()andfile_setattr(). These syscalls are similar toFS_IOC_FSSETXATTRioctl()except they use*at()semantics. Therefore, there's no need to open the file to get a fd.These syscalls allow userspace to set filesystem inode attributes on special files. One of the usage examples is XFS quota projects.
XFS has project quotas which could be attached to a directory. All new inodes in these directories inherit project ID set on parent directory.
The project is created from userspace by opening and calling
FS_IOC_FSSETXATTRon each inode. This is not possible for special files such as FIFO, SOCK, BLK etc. Therefore, some inodes are left with empty project ID. Those inodes then are not shown in the quota accounting but still exist in the directory. This is not critical but in the case when special files are created in the directory with already existing project quota, these new inodes inherit extended attributes. This creates a mix of special files with and without attributes. Moreover, special files with attributes don't have a possibility to become clear or change the attributes. This, in turn, prevents userspace from re-creating quota project on these existing files.NAME
file_getattr/file_setattr - get/set filesystem inode attributes
SYNOPSIS
#include <sys/syscall.h> /* Definition of SYS_* constants */ #include <unistd.h> long syscall(SYS_file_getattr, int dirfd, const char *pathname, struct fsxattr *fsx, size_t size, unsigned int at_flags); long syscall(SYS_file_setattr, int dirfd, const char *pathname, struct fsxattr *fsx, size_t size, unsigned int at_flags); Note: glibc doesn't provide for file_getattr()/file_setattr(), use syscall(2) instead.DESCRIPTION
The syscalls take fd and path. If path is absolute, fd is not used. If path is empty, fd can be
AT_FDCWDor any valid fd which will be used to get/set attributes on.This is an alternative to FS_IOC_FSGETXATTR/FS_IOC_FSSETXATTR ioctl with a difference that file don't need to be open as we can reference it with a path instead of fd. By having this we can manipulated filesystem inode attributes not only on regular files but also on special ones. This is not possible with
FS_IOC_FSSETXATTRioctl as with special files we can not callioctl()directly on the filesystem inode using file descriptor.
at_flagscan be set toAT_SYMLINK_NOFOLLOWorAT_EMPTY_PATH.RETURN VALUE
On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.
ERRORS
EINVAL Invalid
at_flagspecified (only
AT_SYMLINK_NOFOLLOWandAT_EMPTY_PATHis supported).EINVAL Size was smaller than any known version of
struct fsxattr.EINVAL Invalid combination of parameters provided in
fsxattr for this type of file.E2BIG Size of input argument **struct fsxattr** is too
big.EBADF Invalid file descriptor was provided.
EPERM No permission to change this file.
EOPNOTSUPP Filesystem does not support setting attributes
on this type of inodeHISTORY
Added in Linux 6.15.
EXAMPLE
Create directory and file "mkdir ./dir && touch ./dir/foo" and then execute the following program:
#include <fcntl.h> #include <errno.h> #include <string.h> #include <linux/fs.h> #include <stdio.h> #include <sys/syscall.h> #include <unistd.h> int main(int argc, char **argv) { int dfd; int error; struct fsxattr fsx; dfd = open("./dir", O_RDONLY); if (dfd == -1) { printf("can not open ./dir"); return dfd; } error = syscall(467, dfd, "./foo", &fsx, 0); if (error) { printf("can not call 467: %s", strerror(errno)); return error; } printf("dir/foo flags: %d\n", fsx.fsx_xflags); fsx.fsx_xflags |= FS_XFLAG_NODUMP; error = syscall(468, dfd, "./foo", &fsx, 0); if (error) { printf("can not call 468: %s", strerror(errno)); return error; } printf("dir/foo flags: %d\n", fsx.fsx_xflags); return error; }SEE ALSO
ioctl(2), ioctl_iflags(2), ioctl_xfs_fsgetxattr(2)---
Changes in v5:
- Remove setting ofLOOKUP_EMPTYflags which does not have any effect
- Return-ENOSUPPfromvfs_fileattr_set()
- Add fsxattr masking (by Amir)
- Fix UAF issue dentry
- Fixgetname_maybe_null()issue with NULL path
- Implement file_getattr/file_setattr hooks
- Return LSM return code fromfile_setattr
- Rename from getfsxattrat/setfsxattrat to file_getattr/file_setattr
- Link to v4: https://lore.kernel.org/r/[email protected]Changes in v4:
- Usegetname_maybe_null()for correct handling of dfd + path semantic
- Remove restriction for special files on which flags are allowed
- Utilizecopy_struct_from_user()for better future compatibility
- Add draft man page to cover letter
- Convert-ENOIOCTLCMDto-EOPNOSUPPas more appropriate for syscall
- Add missing__userto header declaration of syscalls
- Link to v3: https://lore.kernel.org/r/[email protected]Changes in v3:
- Remove unnecessary "dfd is dir" check as it checked inuser_path_at()
- Remove unnecessary "same filesystem" check
- UseCLASS()instead of directly calling fdget/fdput
- Link to v2: https://lore.kernel.org/r/[email protected]v1:
https://lore.kernel.org/linuxppc-dev/[email protected]/Previous discussion:
https://lore.kernel.org/linux-xfs/[email protected]/---
Amir Goldstein (1):
fs: prepare for extending file_get/setattr()Andrey Albershteyn (6):
fs: split fileattr related helpers into separate file
lsm: introduce new hooks for setting/getting inode fsxattr
selinux: implement inode_file_[g|s]etattr hooks
fs: split fileattr/fsxattr converters into helpers
fs: make vfs_fileattr_[get|set] return-EOPNOSUPP
fs: introducefile_getattrandfile_setattrsyscallsarch/alpha/kernel/syscalls/syscall.tbl | 2 + arch/arm/tools/syscall.tbl | 2 + arch/arm64/tools/syscall_32.tbl | 2 + arch/m68k/kernel/syscalls/syscall.tbl | 2 + arch/microblaze/kernel/syscalls/syscall.tbl | 2 + arch/mips/kernel/syscalls/syscall_n32.tbl | 2 + arch/mips/kernel/syscalls/syscall_n64.tbl | 2 + arch/mips/kernel/syscalls/syscall_o32.tbl | 2 + arch/parisc/kernel/syscalls/syscall.tbl | 2 + arch/powerpc/kernel/syscalls/syscall.tbl | 2 + arch/s390/kernel/syscalls/syscall.tbl | 2 + arch/sh/kernel/syscalls/syscall.tbl | 2 + arch/sparc/kernel/syscalls/syscall.tbl | 2 + arch/x86/entry/syscalls/syscall_32.tbl | 2 + arch/x86/entry/syscalls/syscall_64.tbl | 2 + arch/xtensa/kernel/syscalls/syscall.tbl | 2 + fs/Makefile | 3 +- fs/ecryptfs/inode.c | 8 +- fs/file_attr.c | 475 ++++++++++++++++++++++++++++ fs/ioctl.c | 309 ------------------ fs/overlayfs/inode.c | 2 +- include/linux/fileattr.h | 26 ++ include/linux/lsm_hook_defs.h | 2 + include/linux/security.h | 16 + include/linux/syscalls.h | 6 + include/uapi/asm-generic/unistd.h | 8 +- include/uapi/linux/fs.h | 3 + security/security.c | 30 ++ security/selinux/hooks.c | 14 + 29 files changed, 621 insertions(+), 313 deletions(-)
Quoted 8 lines
---
base-commit:0d8d44db295ccad20052d6301ef49ff01fb8ae2d
change-id: 20250114-xattrat-syscall-6a1136d2db59Best regards,
Signature · 1 line
Andrey Albershteyn <[email protected]>
Ignore please, somehow b4 crashed with timeout on gmail
Signature · 1 line
- Andrey
Christian Brauner
maintainerQuoted 1 line
Ignore please, somehow b4 crashed with timeout on gmail
Ok, no worries. I wondered why I didn't get all messages of that series.