const xattr tables
Subsystems (34)
PATCH 22/29 reiserfs: move reiserfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to reiserfs_xattr_handlers at runtime.
--- fs/reiserfs/reiserfs.h | 2 +- fs/reiserfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/reiserfs/reiserfs.h +1 -1
@@ -1165,7 +1165,7 @@ static inline int bmap_would_wrap(unsigned bmap_nr)return bmap_nr > ((1LL <<16 ) -1 ); } -extern const struct xattr_handler *reiserfs_xattr_handlers[]; +extern const struct xattr_handler *const reiserfs_xattr_handlers[];/* * this says about version of key of all items (but stat data) the
fs/reiserfs/xattr.c +1 -1
@@ -910,7 +910,7 @@ static int create_privroot(struct dentry *dentry) { return 0; }#endif /* Actual operations that are exported to VFS-land */ -const struct xattr_handler *reiserfs_xattr_handlers[] = { +const struct xattr_handler *const reiserfs_xattr_handlers[] = { #ifdef CONFIG_REISERFS_FS_XATTR &reiserfs_xattr_user_handler, &reiserfs_xattr_trusted_handler,
Signature · 1 line
2.34.1
cover const xattr tables
From: Wedson Almeida Filho <[email protected]>
The 's_xattr' field of 'struct super_block' currently requires a mutable table of 'struct xattr_handler' entries (although each handler itself is const). However, no code in vfs actually modifies the tables.
So this series changes the type of 's_xattr' to allow const tables, and modifies existing file system to move their tables to .rodata. This is desirable because these tables contain entries with function pointers in them; moving them to .rodata makes it considerably less likely to be modified accidentally or maliciously at runtime.
I found this while writing Rust abstractions for vfs.
Wedson Almeida Filho (29):
xattr: make the xattr array itself const
ext4: move ext4_xattr_handlers to .rodata
9p: move xattr-related structs to .rodata
afs: move afs_xattr_handlers to .rodata
btrfs: move btrfs_xattr_handlers to .rodata
ceph: move ceph_xattr_handlers to .rodata
ecryptfs: move ecryptfs_xattr_handlers to .rodata
erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
fuse: move fuse_xattr_handlers to .rodata
gfs2: move gfs2_xattr_handlers_max to .rodata
hfs: move hfs_xattr_handlers to .rodata
hfsplus: move hfsplus_xattr_handlers to .rodata
jffs2: move jffs2_xattr_handlers to .rodata
jfs: move jfs_xattr_handlers to .rodata
kernfs: move kernfs_xattr_handlers to .rodata
nfs: move nfs4_xattr_handlers to .rodata
ntfs3: move ntfs_xattr_handlers to .rodata
ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to
.rodata
orangefs: move orangefs_xattr_handlers to .rodata
reiserfs: move reiserfs_xattr_handlers to .rodata
smb: move cifs_xattr_handlers to .rodata
squashfs: move squashfs_xattr_handlers to .rodata
ubifs: move ubifs_xattr_handlers to .rodata
xfs: move xfs_xattr_handlers to .rodata
overlayfs: move xattr tables to .rodata
shmem: move shmem_xattr_handlers to .rodata
net: move sockfs_xattr_handlers to .rodata
fs/9p/xattr.c | 8 ++++---- fs/9p/xattr.h | 2 +- fs/afs/internal.h | 2 +- fs/afs/xattr.c | 2 +- fs/btrfs/xattr.c | 2 +- fs/btrfs/xattr.h | 2 +- fs/ceph/super.h | 2 +- fs/ceph/xattr.c | 2 +- fs/ecryptfs/ecryptfs_kernel.h | 2 +- fs/ecryptfs/inode.c | 2 +- fs/erofs/xattr.c | 2 +- fs/erofs/xattr.h | 4 ++-- fs/ext2/xattr.c | 4 ++-- fs/ext2/xattr.h | 2 +- fs/ext4/xattr.c | 2 +- fs/ext4/xattr.h | 2 +- fs/f2fs/xattr.c | 4 ++-- fs/f2fs/xattr.h | 2 +- fs/fuse/fuse_i.h | 2 +- fs/fuse/xattr.c | 2 +- fs/gfs2/super.h | 4 ++-- fs/gfs2/xattr.c | 4 ++-- fs/hfs/attr.c | 2 +- fs/hfs/hfs_fs.h | 2 +- fs/hfsplus/xattr.c | 2 +- fs/hfsplus/xattr.h | 2 +- fs/jffs2/xattr.c | 2 +- fs/jffs2/xattr.h | 2 +- fs/jfs/jfs_xattr.h | 2 +- fs/jfs/xattr.c | 2 +- fs/kernfs/inode.c | 2 +- fs/kernfs/kernfs-internal.h | 2 +- fs/nfs/nfs.h | 2 +- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/xattr.c | 2 +- fs/ocfs2/xattr.c | 4 ++-- fs/ocfs2/xattr.h | 2 +- fs/orangefs/orangefs-kernel.h | 2 +- fs/orangefs/xattr.c | 2 +- fs/overlayfs/super.c | 4 ++-- fs/reiserfs/reiserfs.h | 2 +- fs/reiserfs/xattr.c | 2 +- fs/smb/client/cifsfs.h | 2 +- fs/smb/client/xattr.c | 2 +- fs/squashfs/squashfs.h | 2 +- fs/squashfs/xattr.c | 2 +- fs/ubifs/ubifs.h | 2 +- fs/ubifs/xattr.c | 2 +- fs/xattr.c | 6 +++--- fs/xfs/xfs_xattr.c | 2 +- fs/xfs/xfs_xattr.h | 2 +- include/linux/fs.h | 2 +- include/linux/pseudo_fs.h | 2 +- mm/shmem.c | 2 +- net/socket.c | 2 +- 57 files changed, 69 insertions(+), 69 deletions(-)
base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c
Signature · 1 line
2.34.1
PATCH 3/29 9p: move xattr-related structs to .rodata
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to v9fs_xattr_user_handler, v9fs_xattr_trusted_handler, v9fs_xattr_security_handler, or v9fs_xattr_handlers at runtime.
--- fs/9p/xattr.c | 8 ++++---- fs/9p/xattr.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
fs/9p/xattr.c +4 -4
@@ -162,27 +162,27 @@ static int v9fs_xattr_handler_set(const struct xattr_handler *handler,return v9fs_xattr_set (dentry, full_name, value, size, flags); } -static struct xattr_handler v9fs_xattr_user_handler = { +static const struct xattr_handler v9fs_xattr_user_handler = { .prefix =XATTR_USER_PREFIX , .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, }; -static struct xattr_handler v9fs_xattr_trusted_handler = { +static const struct xattr_handler v9fs_xattr_trusted_handler = { .prefix =XATTR_TRUSTED_PREFIX , .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, };#ifdef CONFIG_9P_FS_SECURITY -static struct xattr_handler v9fs_xattr_security_handler = { +static const struct xattr_handler v9fs_xattr_security_handler = { .prefix =XATTR_SECURITY_PREFIX , .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, };#endif -const struct xattr_handler *v9fs_xattr_handlers[] = { +const struct xattr_handler *const v9fs_xattr_handlers[] = { &v9fs_xattr_user_handler, &v9fs_xattr_trusted_handler, #ifdef CONFIG_9P_FS_SECURITY
fs/9p/xattr.h +1 -1
@@ -10,7 +10,7 @@#include <net/9p/9p.h> #include <net/9p/client.h> -extern const struct xattr_handler *v9fs_xattr_handlers[]; +extern const struct xattr_handler *const v9fs_xattr_handlers[];ssize_t v9fs_fid_xattr_get (struct p9_fid *fid,const char *name,void *buffer,size_t buffer_size);
Signature · 1 line
2.34.1
PATCH 1/29 xattr: make the xattr array itself const
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
As it is currently declared, the xattr_handler structs are const but the array containing their pointers is not. This patch makes it so that fs modules can place them in .rodata, which makes it harder for accidental/malicious modifications at runtime.
--- fs/xattr.c | 6 +++--- include/linux/fs.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/xattr.c +3 -3
@@ -56,7 +56,7 @@ strcmp_prefix(const char *a, const char *a_prefix)static const struct xattr_handler *xattr_resolve_name (struct inode *inode,const char **name) { -const struct xattr_handler **handlers = inode->i_sb->s_xattr; +const struct xattr_handler *const *handlers = inode->i_sb->s_xattr;const struct xattr_handler *handler;if (!(inode->i_opflags &IOP_XATTR )) {
@@ -162,7 +162,7 @@ xattr_permission(struct mnt_idmap *idmap, struct inode *inode,int xattr_supports_user_prefix (struct inode *inode) { -const struct xattr_handler **handlers = inode->i_sb->s_xattr; +const struct xattr_handler *const *handlers = inode->i_sb->s_xattr;const struct xattr_handler *handler;if (!(inode->i_opflags &IOP_XATTR )) {
@@ -999,7 +999,7 @@ int xattr_list_one(char **buffer, ssize_t *remaining_size, const char *name)ssize_t generic_listxattr (struct dentry *dentry,char *buffer,size_t buffer_size) { -const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; +const struct xattr_handler *handler, *const *handlers = dentry->d_sb->s_xattr;ssize_t remaining_size = buffer_size;int err =0 ;
include/linux/fs.h +1 -1
@@ -1172,7 +1172,7 @@ struct super_block {#ifdef CONFIG_SECURITY void *s_security;#endif -const struct xattr_handler **s_xattr; +const struct xattr_handler *const *s_xattr;#ifdef CONFIG_FS_ENCRYPTION const struct fscrypt_operations *s_cop;struct fscrypt_keyring *s_master_keys;/* master crypto keys in use */
Signature · 1 line
2.34.1
PATCH 2/29 ext4: move ext4_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ext4_xattr_handlers at runtime.
--- fs/ext4/xattr.c | 2 +- fs/ext4/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ext4/xattr.c +1 -1
@@ -98,7 +98,7 @@ static const struct xattr_handler * const ext4_xattr_handler_map[] = { [EXT4_XATTR_INDEX_HURD] = &ext4_xattr_hurd_handler, }; -const struct xattr_handler *ext4_xattr_handlers[] = { +const struct xattr_handler *const ext4_xattr_handlers[] = { &ext4_xattr_user_handler, &ext4_xattr_trusted_handler, #ifdef CONFIG_EXT4_FS_SECURITY
fs/ext4/xattr.h +1 -1
@@ -193,7 +193,7 @@ extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, struct ext4_inode *raw_inode, handle_t *handle);extern void ext4_evict_ea_inode (struct inode *inode); -extern const struct xattr_handler *ext4_xattr_handlers[]; +extern const struct xattr_handler *const ext4_xattr_handlers[];extern int ext4_xattr_ibody_find (struct inode *inode,struct ext4_xattr_info *i,struct ext4_xattr_ibody_find *is);
Signature · 1 line
2.34.1
PATCH 4/29 afs: move afs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to afs_xattr_handlers at runtime.
--- fs/afs/internal.h | 2 +- fs/afs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/afs/internal.h +1 -1
@@ -1539,7 +1539,7 @@ int afs_launder_folio(struct folio *);/* * xattr.c */ -extern const struct xattr_handler *afs_xattr_handlers[]; +extern const struct xattr_handler *const afs_xattr_handlers[];/* * yfsclient.c
fs/afs/xattr.c +1 -1
@@ -353,7 +353,7 @@ static const struct xattr_handler afs_xattr_afs_volume_handler = { .get = afs_xattr_get_volume, }; -const struct xattr_handler *afs_xattr_handlers[] = { +const struct xattr_handler *const afs_xattr_handlers[] = { &afs_xattr_afs_acl_handler, &afs_xattr_afs_cell_handler, &afs_xattr_afs_fid_handler,
Signature · 1 line
2.34.1
PATCH 5/29 btrfs: move btrfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to btrfs_xattr_handlers at runtime.
--- fs/btrfs/xattr.c | 2 +- fs/btrfs/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/xattr.c +1 -1
@@ -442,7 +442,7 @@ static const struct xattr_handler btrfs_btrfs_xattr_handler = { .set = btrfs_xattr_handler_set_prop, }; -const struct xattr_handler *btrfs_xattr_handlers[] = { +const struct xattr_handler *const btrfs_xattr_handlers[] = { &btrfs_security_xattr_handler, &btrfs_trusted_xattr_handler, &btrfs_user_xattr_handler,
fs/btrfs/xattr.h +1 -1
@@ -8,7 +8,7 @@#include <linux/xattr.h> -extern const struct xattr_handler *btrfs_xattr_handlers[]; +extern const struct xattr_handler *const btrfs_xattr_handlers[];int btrfs_getxattr (struct inode *inode,const char *name,void *buffer,size_t size);
Signature · 1 line
2.34.1
PATCH 10/29 f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to f2fs_xattr_handlers or f2fs_xattr_handler_map at runtime.
--- fs/f2fs/xattr.c | 4 ++-- fs/f2fs/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/xattr.c +2 -2
@@ -189,7 +189,7 @@ const struct xattr_handler f2fs_xattr_security_handler = { .set = f2fs_xattr_generic_set, }; -static const struct xattr_handler *f2fs_xattr_handler_map[] = { +static const struct xattr_handler *const f2fs_xattr_handler_map[] = { [F2FS_XATTR_INDEX_USER ] = &f2fs_xattr_user_handler, #ifdef CONFIG_F2FS_FS_POSIX_ACL [F2FS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access,
@@ -202,7 +202,7 @@ static const struct xattr_handler *f2fs_xattr_handler_map[] = { [F2FS_XATTR_INDEX_ADVISE] = &f2fs_xattr_advise_handler, }; -const struct xattr_handler *f2fs_xattr_handlers[] = { +const struct xattr_handler *const f2fs_xattr_handlers[] = { &f2fs_xattr_user_handler, &f2fs_xattr_trusted_handler, #ifdef CONFIG_F2FS_FS_SECURITY
fs/f2fs/xattr.h +1 -1
@@ -125,7 +125,7 @@ extern const struct xattr_handler f2fs_xattr_trusted_handler;extern const struct xattr_handler f2fs_xattr_advise_handler;extern const struct xattr_handler f2fs_xattr_security_handler; -extern const struct xattr_handler *f2fs_xattr_handlers[]; +extern const struct xattr_handler *const f2fs_xattr_handlers[];extern int f2fs_setxattr (struct inode *,int ,const char *,const void *,size_t ,struct page *,int );
Signature · 8 lines
2.34.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH 8/29 erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to erofs_xattr_handlers or xattr_handler_map at runtime.
--- fs/erofs/xattr.c | 2 +- fs/erofs/xattr.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/erofs/xattr.c +1 -1
@@ -166,7 +166,7 @@ const struct xattr_handler __maybe_unused erofs_xattr_security_handler = { };#endif -const struct xattr_handler *erofs_xattr_handlers[] = { +const struct xattr_handler *const erofs_xattr_handlers[] = { &erofs_xattr_user_handler, &erofs_xattr_trusted_handler, #ifdef CONFIG_EROFS_FS_SECURITY
fs/erofs/xattr.h +2 -2
@@ -23,7 +23,7 @@ static inline const char *erofs_xattr_prefix(unsigned int idx, {const struct xattr_handler *handler =NULL ; -static const struct xattr_handler *xattr_handler_map[] = { +static const struct xattr_handler *const xattr_handler_map[] = { [EROFS_XATTR_INDEX_USER ] = &erofs_xattr_user_handler, #ifdef CONFIG_EROFS_FS_POSIX_ACL [EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access,
@@ -44,7 +44,7 @@ static inline const char *erofs_xattr_prefix(unsigned int idx,return xattr_prefix (handler); } -extern const struct xattr_handler *erofs_xattr_handlers[]; +extern const struct xattr_handler *const erofs_xattr_handlers[];int erofs_xattr_prefixes_init (struct super_block *sb);void erofs_xattr_prefixes_cleanup (struct super_block *sb);
Signature · 1 line
2.34.1
PATCH 7/29 ecryptfs: move ecryptfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ecryptfs_xattr_handlers at runtime.
--- fs/ecryptfs/ecryptfs_kernel.h | 2 +- fs/ecryptfs/inode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ecryptfs/ecryptfs_kernel.h +1 -1
@@ -702,6 +702,6 @@ int ecryptfs_set_f_namelen(long *namelen, long lower_namelen,int ecryptfs_derive_iv (char *iv,struct ecryptfs_crypt_stat *crypt_stat,loff_t offset); -extern const struct xattr_handler *ecryptfs_xattr_handlers[]; +extern const struct xattr_handler *const ecryptfs_xattr_handlers[];#endif /* #ifndef ECRYPTFS_KERNEL_H */
fs/ecryptfs/inode.c +1 -1
@@ -1209,7 +1209,7 @@ static const struct xattr_handler ecryptfs_xattr_handler = { .set = ecryptfs_xattr_set, }; -const struct xattr_handler *ecryptfs_xattr_handlers[] = { +const struct xattr_handler *const ecryptfs_xattr_handlers[] = { &ecryptfs_xattr_handler,NULL };
Signature · 1 line
2.34.1
PATCH 19/29 ntfs3: move ntfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ntfs_xattr_handlers at runtime.
--- fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/ntfs_fs.h +1 -1
@@ -872,7 +872,7 @@ int ntfs_init_acl(struct mnt_idmap *idmap, struct inode *inode,int ntfs_acl_chmod (struct mnt_idmap *idmap,struct dentry *dentry);ssize_t ntfs_listxattr (struct dentry *dentry,char *buffer,size_t size); -extern const struct xattr_handler *ntfs_xattr_handlers[]; +extern const struct xattr_handler *const ntfs_xattr_handlers[];int ntfs_save_wsl_perm (struct inode *inode,__le16 *ea_size);void ntfs_get_wsl_perm (struct inode *inode);
fs/ntfs3/xattr.c +1 -1
@@ -1016,7 +1016,7 @@ static const struct xattr_handler ntfs_other_xattr_handler = { .list = ntfs_xattr_user_list, }; -const struct xattr_handler *ntfs_xattr_handlers[] = { +const struct xattr_handler *const ntfs_xattr_handlers[] = { &ntfs_other_xattr_handler,NULL , };
Signature · 1 line
2.34.1
PATCH 6/29 ceph: move ceph_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ceph_xattr_handlers at runtime.
--- fs/ceph/super.h | 2 +- fs/ceph/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ceph/super.h +1 -1
@@ -1089,7 +1089,7 @@ ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t);extern ssize_t ceph_listxattr (struct dentry *,char *,size_t );extern struct ceph_buffer *__ceph_build_xattrs_blob (struct ceph_inode_info *ci);extern void __ceph_destroy_xattrs (struct ceph_inode_info *ci); -extern const struct xattr_handler *ceph_xattr_handlers[]; +extern const struct xattr_handler *const ceph_xattr_handlers[];struct ceph_acl_sec_ctx {#ifdef CONFIG_CEPH_FS_POSIX_ACL
fs/ceph/xattr.c +1 -1
@@ -1416,7 +1416,7 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx)* List of handlers for synthetic system.* attributes. Other * attributes are handled directly. */ -const struct xattr_handler *ceph_xattr_handlers[] = { +const struct xattr_handler *const ceph_xattr_handlers[] = { &ceph_other_xattr_handler,NULL , };
Signature · 1 line
2.34.1
PATCH 15/29 jffs2: move jffs2_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to jffs2_xattr_handlers at runtime.
--- fs/jffs2/xattr.c | 2 +- fs/jffs2/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/jffs2/xattr.c +1 -1
@@ -920,7 +920,7 @@ struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,* do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags) * is an implementation of setxattr handler on jffs2. * -------------------------------------------------- */ -const struct xattr_handler *jffs2_xattr_handlers[] = { +const struct xattr_handler *const jffs2_xattr_handlers[] = { &jffs2_user_xattr_handler, #ifdef CONFIG_JFFS2_FS_SECURITY &jffs2_security_xattr_handler,
fs/jffs2/xattr.h +1 -1
@@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xnameextern int do_jffs2_setxattr (struct inode *inode,int xprefix,const char *xname,const char *buffer,size_t size,int flags); -extern const struct xattr_handler *jffs2_xattr_handlers[]; +extern const struct xattr_handler *const jffs2_xattr_handlers[];extern const struct xattr_handler jffs2_user_xattr_handler;extern const struct xattr_handler jffs2_trusted_xattr_handler;
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 20/29 ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ocfs2_xattr_handlers or ocfs2_xattr_handler_map at runtime.
--- fs/ocfs2/xattr.c | 4 ++-- fs/ocfs2/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/ocfs2/xattr.c +2 -2
@@ -87,14 +87,14 @@ static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count = cpu_to_le16(1), }; -const struct xattr_handler *ocfs2_xattr_handlers[] = { +const struct xattr_handler *const ocfs2_xattr_handlers[] = { &ocfs2_xattr_user_handler, &ocfs2_xattr_trusted_handler, &ocfs2_xattr_security_handler,NULL }; -static const struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX ] = { +static const struct xattr_handler *const ocfs2_xattr_handler_map[OCFS2_XATTR_MAX ] = { [OCFS2_XATTR_INDEX_USER ] = &ocfs2_xattr_user_handler, [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS ] = &nop_posix_acl_access, [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT ] = &nop_posix_acl_default,
fs/ocfs2/xattr.h +1 -1
@@ -30,7 +30,7 @@ struct ocfs2_security_xattr_info {extern const struct xattr_handler ocfs2_xattr_user_handler;extern const struct xattr_handler ocfs2_xattr_trusted_handler;extern const struct xattr_handler ocfs2_xattr_security_handler; -extern const struct xattr_handler *ocfs2_xattr_handlers[]; +extern const struct xattr_handler *const ocfs2_xattr_handlers[];ssize_t ocfs2_listxattr (struct dentry *,char *,size_t ); int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
Signature · 1 line
2.34.1
PATCH 9/29 ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ext2_xattr_handlers or ext2_xattr_handler_map at runtime.
--- fs/ext2/xattr.c | 4 ++-- fs/ext2/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/ext2/xattr.c +2 -2
@@ -98,7 +98,7 @@ static struct buffer_head *ext2_xattr_cache_find(struct inode *,static void ext2_xattr_rehash (struct ext2_xattr_header *,struct ext2_xattr_entry *); -static const struct xattr_handler *ext2_xattr_handler_map[] = { +static const struct xattr_handler *const ext2_xattr_handler_map[] = { [EXT2_XATTR_INDEX_USER ] = &ext2_xattr_user_handler, #ifdef CONFIG_EXT2_FS_POSIX_ACL [EXT2_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access,
@@ -110,7 +110,7 @@ static const struct xattr_handler *ext2_xattr_handler_map[] = {#endif }; -const struct xattr_handler *ext2_xattr_handlers[] = { +const struct xattr_handler *const ext2_xattr_handlers[] = { &ext2_xattr_user_handler, &ext2_xattr_trusted_handler, #ifdef CONFIG_EXT2_FS_SECURITY
fs/ext2/xattr.h +1 -1
@@ -72,7 +72,7 @@ extern void ext2_xattr_delete_inode(struct inode *);extern struct mb_cache *ext2_xattr_create_cache (void );extern void ext2_xattr_destroy_cache (struct mb_cache *cache); -extern const struct xattr_handler *ext2_xattr_handlers[]; +extern const struct xattr_handler *const ext2_xattr_handlers[];# else /* CONFIG_EXT2_FS_XATTR */
Signature · 1 line
2.34.1
PATCH 11/29 fuse: move fuse_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to fuse_xattr_handlers at runtime.
--- fs/fuse/fuse_i.h | 2 +- fs/fuse/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/fuse/fuse_i.h +1 -1
@@ -1268,7 +1268,7 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value, size_t size);ssize_t fuse_listxattr (struct dentry *entry,char *list,size_t size);int fuse_removexattr (struct inode *inode,const char *name); -extern const struct xattr_handler *fuse_xattr_handlers[]; +extern const struct xattr_handler *const fuse_xattr_handlers[];struct posix_acl ;struct posix_acl *fuse_get_inode_acl (struct inode *inode,int type,bool rcu);
fs/fuse/xattr.c +1 -1
@@ -209,7 +209,7 @@ static const struct xattr_handler fuse_xattr_handler = { .set = fuse_xattr_set, }; -const struct xattr_handler *fuse_xattr_handlers[] = { +const struct xattr_handler *const fuse_xattr_handlers[] = { &fuse_xattr_handler,NULL };
Signature · 1 line
2.34.1
PATCH 12/29 gfs2: move gfs2_xattr_handlers_max to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to gfs2_xattr_handlers_max at runtime.
--- fs/gfs2/super.h | 4 ++-- fs/gfs2/xattr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/gfs2/super.h +2 -2
@@ -59,8 +59,8 @@ extern const struct export_operations gfs2_export_ops;extern const struct super_operations gfs2_super_ops;extern const struct dentry_operations gfs2_dops; -extern const struct xattr_handler *gfs2_xattr_handlers_max[]; -extern const struct xattr_handler **gfs2_xattr_handlers_min; +extern const struct xattr_handler *const gfs2_xattr_handlers_max[]; +extern const struct xattr_handler *const *gfs2_xattr_handlers_min;#endif /* __SUPER_DOT_H__ */
fs/gfs2/xattr.c +2 -2
@@ -1494,7 +1494,7 @@ static const struct xattr_handler gfs2_xattr_trusted_handler = { .set = gfs2_xattr_set, }; -const struct xattr_handler *gfs2_xattr_handlers_max[] = { +const struct xattr_handler *const gfs2_xattr_handlers_max[] = {/* GFS2_FS_FORMAT_MAX */ &gfs2_xattr_trusted_handler,
@@ -1504,4 +1504,4 @@ const struct xattr_handler *gfs2_xattr_handlers_max[] = { NULL, }; -const struct xattr_handler **gfs2_xattr_handlers_min = gfs2_xattr_handlers_max +1 ; +const struct xattr_handler *const *gfs2_xattr_handlers_min = gfs2_xattr_handlers_max +1 ;
Signature · 1 line
2.34.1
PATCH 25/29 ubifs: move ubifs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ubifs_xattr_handlers at runtime.
--- fs/ubifs/ubifs.h | 2 +- fs/ubifs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ubifs/ubifs.h +1 -1
@@ -2043,7 +2043,7 @@ ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf, size_t size);#ifdef CONFIG_UBIFS_FS_XATTR -extern const struct xattr_handler *ubifs_xattr_handlers[]; +extern const struct xattr_handler *const ubifs_xattr_handlers[];ssize_t ubifs_listxattr (struct dentry *dentry,char *buffer,size_t size);void ubifs_evict_xattr_inode (struct ubifs_info *c,ino_t xattr_inum);int ubifs_purge_xattrs (struct inode *host);
fs/ubifs/xattr.c +1 -1
@@ -735,7 +735,7 @@ static const struct xattr_handler ubifs_security_xattr_handler = { };#endif -const struct xattr_handler *ubifs_xattr_handlers[] = { +const struct xattr_handler *const ubifs_xattr_handlers[] = { &ubifs_user_xattr_handler, &ubifs_trusted_xattr_handler, #ifdef CONFIG_UBIFS_FS_SECURITY
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 28/29 shmem: move shmem_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to shmem_xattr_handlers at runtime.
--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
@@ -3487,7 +3487,7 @@ static const struct xattr_handler shmem_trusted_xattr_handler = { .set = shmem_xattr_handler_set, }; -static const struct xattr_handler *shmem_xattr_handlers[] = { +static const struct xattr_handler *const shmem_xattr_handlers[] = { &shmem_security_xattr_handler, &shmem_trusted_xattr_handler,NULL
Signature · 1 line
2.34.1
PATCH 29/29 net: move sockfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to sockfs_xattr_handlers at runtime.
--- include/linux/pseudo_fs.h | 2 +- net/socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/pseudo_fs.h +1 -1
@@ -5,7 +5,7 @@struct pseudo_fs_context {const struct super_operations *ops; -const struct xattr_handler **xattr; +const struct xattr_handler *const *xattr;const struct dentry_operations *dops;unsigned long magic; };
net/socket.c +1 -1
@@ -400,7 +400,7 @@ static const struct xattr_handler sockfs_security_xattr_handler = { .set = sockfs_security_xattr_set, }; -static const struct xattr_handler *sockfs_xattr_handlers[] = { +static const struct xattr_handler *const sockfs_xattr_handlers[] = { &sockfs_xattr_handler, &sockfs_security_xattr_handler,NULL
Signature · 1 line
2.34.1
PATCH 13/29 hfs: move hfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to hfs_xattr_handlers at runtime.
--- fs/hfs/attr.c | 2 +- fs/hfs/hfs_fs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/hfs/attr.c +1 -1
@@ -146,7 +146,7 @@ static const struct xattr_handler hfs_type_handler = { .set = hfs_xattr_set, }; -const struct xattr_handler *hfs_xattr_handlers[] = { +const struct xattr_handler *const hfs_xattr_handlers[] = { &hfs_creator_handler, &hfs_type_handler,NULL
fs/hfs/hfs_fs.h +1 -1
@@ -215,7 +215,7 @@ extern void hfs_evict_inode(struct inode *);extern void hfs_delete_inode (struct inode *);/* attr.c */ -extern const struct xattr_handler *hfs_xattr_handlers[]; +extern const struct xattr_handler *const hfs_xattr_handlers[];/* mdb.c */ extern int hfs_mdb_get (struct super_block *);
Signature · 1 line
2.34.1
PATCH 14/29 hfsplus: move hfsplus_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to hfsplus_xattr_handlers at runtime.
--- fs/hfsplus/xattr.c | 2 +- fs/hfsplus/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/hfsplus/xattr.c +1 -1
@@ -13,7 +13,7 @@static int hfsplus_removexattr (struct inode *inode,const char *name); -const struct xattr_handler *hfsplus_xattr_handlers[] = { +const struct xattr_handler *const hfsplus_xattr_handlers[] = { &hfsplus_xattr_osx_handler, &hfsplus_xattr_user_handler, &hfsplus_xattr_trusted_handler,
fs/hfsplus/xattr.h +1 -1
@@ -17,7 +17,7 @@ extern const struct xattr_handler hfsplus_xattr_user_handler;extern const struct xattr_handler hfsplus_xattr_trusted_handler;extern const struct xattr_handler hfsplus_xattr_security_handler; -extern const struct xattr_handler *hfsplus_xattr_handlers[]; +extern const struct xattr_handler *const hfsplus_xattr_handlers[];int __hfsplus_setxattr (struct inode *inode,const char *name,const void *value,size_t size,int flags);
Signature · 1 line
2.34.1
PATCH 16/29 jfs: move jfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to jfs_xattr_handlers at runtime.
--- fs/jfs/jfs_xattr.h | 2 +- fs/jfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/jfs/jfs_xattr.h +1 -1
@@ -46,7 +46,7 @@ extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,extern ssize_t __jfs_getxattr (struct inode *,const char *,void *,size_t );extern ssize_t jfs_listxattr (struct dentry *,char *,size_t ); -extern const struct xattr_handler *jfs_xattr_handlers[]; +extern const struct xattr_handler *const jfs_xattr_handlers[];#ifdef CONFIG_JFS_SECURITY extern int jfs_init_security(tid_t, struct inode *, struct inode *,
fs/jfs/xattr.c +1 -1
@@ -985,7 +985,7 @@ static const struct xattr_handler jfs_trusted_xattr_handler = { .set = jfs_xattr_set, }; -const struct xattr_handler *jfs_xattr_handlers[] = { +const struct xattr_handler *const jfs_xattr_handlers[] = { &jfs_os2_xattr_handler, &jfs_user_xattr_handler, &jfs_security_xattr_handler,
Signature · 1 line
2.34.1
PATCH 17/29 kernfs: move kernfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to kernfs_xattr_handlers at runtime.
--- fs/kernfs/inode.c | 2 +- fs/kernfs/kernfs-internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/kernfs/inode.c +1 -1
@@ -434,7 +434,7 @@ static const struct xattr_handler kernfs_user_xattr_handler = { .set = kernfs_vfs_user_xattr_set, }; -const struct xattr_handler *kernfs_xattr_handlers[] = { +const struct xattr_handler *const kernfs_xattr_handlers[] = { &kernfs_trusted_xattr_handler, &kernfs_security_xattr_handler, &kernfs_user_xattr_handler,
fs/kernfs/kernfs-internal.h +1 -1
@@ -127,7 +127,7 @@ extern struct kmem_cache *kernfs_node_cache, *kernfs_iattrs_cache;/* * inode.c */ -extern const struct xattr_handler *kernfs_xattr_handlers[]; +extern const struct xattr_handler *const kernfs_xattr_handlers[];void kernfs_evict_inode (struct inode *inode);int kernfs_iop_permission (struct mnt_idmap *idmap,struct inode *inode,int mask);
Signature · 1 line
2.34.1
PATCH 18/29 nfs: move nfs4_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to nfs4_xattr_handlers at runtime.
--- fs/nfs/nfs.h | 2 +- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
fs/nfs/nfs.h +1 -1
@@ -18,7 +18,7 @@ struct nfs_subversion {const struct rpc_version *rpc_vers;/* NFS version information */ const struct nfs_rpc_ops *rpc_ops;/* NFS operations */ const struct super_operations *sops;/* NFS Super operations */ -const struct xattr_handler **xattr;/* NFS xattr handlers */ +const struct xattr_handler *const *xattr;/* NFS xattr handlers */ struct list_head list;/* List of NFS versions */ };
fs/nfs/nfs4_fs.h +1 -1
@@ -315,7 +315,7 @@ extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct nfs_fh *, struct nfs_fattr *);extern int nfs4_proc_secinfo (struct inode *,const struct qstr *,struct nfs4_secinfo_flavors *); -extern const struct xattr_handler *nfs4_xattr_handlers[]; +extern const struct xattr_handler *const nfs4_xattr_handlers[]; extern int nfs4_set_rw_stateid(nfs4_stateid *stateid, const struct nfs_open_context *ctx, const struct nfs_lock_context *l_ctx,
fs/nfs/nfs4proc.c +1 -1
@@ -10740,7 +10740,7 @@ static const struct xattr_handler nfs4_xattr_nfs4_user_handler = { };#endif -const struct xattr_handler *nfs4_xattr_handlers[] = { +const struct xattr_handler *const nfs4_xattr_handlers[] = { &nfs4_xattr_nfs4_acl_handler, #if defined(CONFIG_NFS_V4_1) &nfs4_xattr_nfs4_dacl_handler,
Signature · 1 line
2.34.1
PATCH 21/29 orangefs: move orangefs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to orangefs_xattr_handlers at runtime.
--- fs/orangefs/orangefs-kernel.h | 2 +- fs/orangefs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/orangefs/orangefs-kernel.h +1 -1
@@ -103,7 +103,7 @@ enum orangefs_vfs_op_states {#define ORANGEFS_CACHE_CREATE_FLAGS 0#endif -extern const struct xattr_handler *orangefs_xattr_handlers[]; +extern const struct xattr_handler *const orangefs_xattr_handlers[];extern struct posix_acl *orangefs_get_acl (struct inode *inode,int type,bool rcu); extern int orangefs_set_acl(struct mnt_idmap *idmap,
fs/orangefs/xattr.c +1 -1
@@ -554,7 +554,7 @@ static const struct xattr_handler orangefs_xattr_default_handler = { .set = orangefs_xattr_set_default, }; -const struct xattr_handler *orangefs_xattr_handlers[] = { +const struct xattr_handler *const orangefs_xattr_handlers[] = { &orangefs_xattr_default_handler,NULL };
Signature · 1 line
2.34.1
PATCH 23/29 smb: move cifs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to cifs_xattr_handlers at runtime.
--- fs/smb/client/cifsfs.h | 2 +- fs/smb/client/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/cifsfs.h +1 -1
@@ -134,7 +134,7 @@ extern int cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, struct dentry *direntry, const char *symname);#ifdef CONFIG_CIFS_XATTR -extern const struct xattr_handler *cifs_xattr_handlers[]; +extern const struct xattr_handler *const cifs_xattr_handlers[];extern ssize_t cifs_listxattr (struct dentry *,char *,size_t );#else # define cifs_xattr_handlers NULL
fs/smb/client/xattr.c +1 -1
@@ -478,7 +478,7 @@ static const struct xattr_handler smb3_ntsd_full_xattr_handler = { .set = cifs_xattr_set, }; -const struct xattr_handler *cifs_xattr_handlers[] = { +const struct xattr_handler *const cifs_xattr_handlers[] = { &cifs_user_xattr_handler, &cifs_os2_xattr_handler, &cifs_cifs_acl_xattr_handler,
Signature · 1 line
2.34.1
PATCH 24/29 squashfs: move squashfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to squashfs_xattr_handlers at runtime.
--- fs/squashfs/squashfs.h | 2 +- fs/squashfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/squashfs/squashfs.h +1 -1
@@ -111,4 +111,4 @@ extern const struct address_space_operations squashfs_symlink_aops;extern const struct inode_operations squashfs_symlink_inode_ops;/* xattr.c */ -extern const struct xattr_handler *squashfs_xattr_handlers[]; +extern const struct xattr_handler *const squashfs_xattr_handlers[];
fs/squashfs/xattr.c +1 -1
@@ -262,7 +262,7 @@ static const struct xattr_handler *squashfs_xattr_handler(int type) } } -const struct xattr_handler *squashfs_xattr_handlers[] = { +const struct xattr_handler *const squashfs_xattr_handlers[] = { &squashfs_xattr_user_handler, &squashfs_xattr_trusted_handler, &squashfs_xattr_security_handler,
Signature · 1 line
2.34.1
PATCH 26/29 xfs: move xfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to xfs_xattr_handlers at runtime.
--- fs/xfs/xfs_xattr.c | 2 +- fs/xfs/xfs_xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_xattr.c +1 -1
@@ -175,7 +175,7 @@ static const struct xattr_handler xfs_xattr_security_handler = { .set = xfs_xattr_set, }; -const struct xattr_handler *xfs_xattr_handlers[] = { +const struct xattr_handler *const xfs_xattr_handlers[] = { &xfs_xattr_user_handler, &xfs_xattr_trusted_handler, &xfs_xattr_security_handler,
fs/xfs/xfs_xattr.h +1 -1
@@ -8,6 +8,6 @@int xfs_attr_change (struct xfs_da_args *args); -extern const struct xattr_handler *xfs_xattr_handlers[]; +extern const struct xattr_handler *const xfs_xattr_handlers[];#endif /* __XFS_XATTR_H__ */
Signature · 1 line
2.34.1
PATCH 27/29 overlayfs: move xattr tables to .rodata
In reply to Wedson Almeida FilhoFrom: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to ovl_trusted_xattr_handlers or ovl_user_xattr_handlers at runtime.
--- fs/overlayfs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/overlayfs/super.c +2 -2
@@ -477,13 +477,13 @@ static const struct xattr_handler ovl_other_xattr_handler = { .set = ovl_other_xattr_set, }; -static const struct xattr_handler *ovl_trusted_xattr_handlers[] = { +static const struct xattr_handler *const ovl_trusted_xattr_handlers[] = { &ovl_own_trusted_xattr_handler, &ovl_other_xattr_handler,NULL }; -static const struct xattr_handler *ovl_user_xattr_handlers[] = { +static const struct xattr_handler *const ovl_user_xattr_handlers[] = { &ovl_own_user_xattr_handler, &ovl_other_xattr_handler,NULL
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH 01/29] xattr: make the xattr array itself const
In reply to Wedson Almeida Filhokernel test robot noticed the following build warnings:
Hi Wedson,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 2dde18cd1d8fac735875f2e4987f11817cc0bc2c]
url: https://github.com/intel-lab-lkp/linux/commits/Wedson-Almeida-Filho/xattr-make-the-xattr-array-itself-const/20230930-130453 base: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c patch link: https://lore.kernel.org/r/20230930050033.41174-2-wedsonaf%40gmail.com patch subject: [PATCH 01/29] xattr: make the xattr array itself const config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230930/[email protected]/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
fs/reiserfs/xattr.c: In function 'listxattr_filler':
>> fs/reiserfs/xattr.c:822:57: warning: passing argument 1 of 'reiserfs_xattr_list' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
822 | if (!reiserfs_xattr_list(b->dentry->d_sb->s_xattr, name,
| ~~~~~~~~~~~~~~~^~~~~~~~~ fs/reiserfs/xattr.c:782:69: note: expected 'const struct xattr_handler **' but argument is of type 'const struct xattr_handler * const*'
782 | static inline bool reiserfs_xattr_list(const struct xattr_handler **handlers,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
vim +822 fs/reiserfs/xattr.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 811
25885a35a72007 Al Viro 2022-08-16 812 static bool listxattr_filler(struct dir_context *ctx, const char *name,
ac7576f4b1da8c Miklos Szeredi 2014-10-30 813 int namelen, loff_t offset, u64 ino,
ac7576f4b1da8c Miklos Szeredi 2014-10-30 814 unsigned int d_type)
^1da177e4c3f41 Linus Torvalds 2005-04-16 815 {
ac7576f4b1da8c Miklos Szeredi 2014-10-30 816 struct listxattr_buf *b =
ac7576f4b1da8c Miklos Szeredi 2014-10-30 817 container_of(ctx, struct listxattr_buf, ctx);
48b32a3553a547 Jeff Mahoney 2009-03-30 818 size_t size;
f3fb9e27325c4e Fabian Frederick 2014-08-08 819
48b32a3553a547 Jeff Mahoney 2009-03-30 820 if (name[0] != '.' ||
48b32a3553a547 Jeff Mahoney 2009-03-30 821 (namelen != 1 && (name[1] != '.' || namelen != 2))) {
387b96a5891c07 Christian Brauner 2023-02-01 @822 if (!reiserfs_xattr_list(b->dentry->d_sb->s_xattr, name,
387b96a5891c07 Christian Brauner 2023-02-01 823 b->dentry))
25885a35a72007 Al Viro 2022-08-16 824 return true;
764a5c6b1fa430 Andreas Gruenbacher 2015-12-02 825 size = namelen + 1;
48b32a3553a547 Jeff Mahoney 2009-03-30 826 if (b->buf) {
a13f085d111e90 Jann Horn 2018-08-21 827 if (b->pos + size > b->size) {
a13f085d111e90 Jann Horn 2018-08-21 828 b->pos = -ERANGE;
25885a35a72007 Al Viro 2022-08-16 829 return false;
a13f085d111e90 Jann Horn 2018-08-21 830 }
764a5c6b1fa430 Andreas Gruenbacher 2015-12-02 831 memcpy(b->buf + b->pos, name, namelen);
764a5c6b1fa430 Andreas Gruenbacher 2015-12-02 832 b->buf[b->pos + namelen] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 833 }
48b32a3553a547 Jeff Mahoney 2009-03-30 834 b->pos += size;
48b32a3553a547 Jeff Mahoney 2009-03-30 835 }
25885a35a72007 Al Viro 2022-08-16 836 return true;
^1da177e4c3f41 Linus Torvalds 2005-04-16 837 }
bd4c625c061c2a Linus Torvalds 2005-07-12 838 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
In reply to Wedson Almeida FilhoQuoted 6 lines · CEST Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
v9fs_xattr_user_handler,v9fs_xattr_trusted_handler,v9fs_xattr_security_handler, orv9fs_xattr_handlersat runtime.
Quoted 6 lines
Cc Eric Van Hensbergen <[email protected]>Cc Latchesar Ionkov <[email protected]>Cc Dominique Martinet <[email protected]>Cc Christian Schoenebeck <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Quoted 55 lines
--- fs/9p/xattr.c | 8 ++++---- fs/9p/xattr.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)fs/9p/xattr.c +4
-4@@ -162,27 +162,27 @@ static int v9fs_xattr_handler_set(const struct xattr_handler *handler,return v9fs_xattr_set (dentry, full_name, value, size, flags); } -static struct xattr_handler v9fs_xattr_user_handler = { +static const struct xattr_handler v9fs_xattr_user_handler = { .prefix =XATTR_USER_PREFIX , .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, }; -static struct xattr_handler v9fs_xattr_trusted_handler = { +static const struct xattr_handler v9fs_xattr_trusted_handler = { .prefix =XATTR_TRUSTED_PREFIX , .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, };#ifdef CONFIG_9P_FS_SECURITY -static struct xattr_handler v9fs_xattr_security_handler = { +static const struct xattr_handler v9fs_xattr_security_handler = { .prefix =XATTR_SECURITY_PREFIX , .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, };#endif -const struct xattr_handler *v9fs_xattr_handlers[] = { +const struct xattr_handler *const v9fs_xattr_handlers[] = { &v9fs_xattr_user_handler, &v9fs_xattr_trusted_handler, #ifdef CONFIG_9P_FS_SECURITYfs/9p/xattr.h +1
-1@@ -10,7 +10,7 @@#include <net/9p/9p.h> #include <net/9p/client.h> -extern const struct xattr_handler *v9fs_xattr_handlers[]; +extern const struct xattr_handler *const v9fs_xattr_handlers[];ssize_t v9fs_fid_xattr_get (struct p9_fid *fid,const char *name,void *buffer,size_t buffer_size);
Dominique Martinet
maintainerRe: [PATCH 03/29] 9p: move xattr-related structs to .rodata
Christian Schoenebeck wrote on Sat, Sep 30, 2023 at 10:12:25AM +0200:
Quoted 7 lines · CEST Wedson Almeida Filho
Quoted 6 lines
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
v9fs_xattr_user_handler,v9fs_xattr_trusted_handler,v9fs_xattr_security_handler, orv9fs_xattr_handlersat runtime.
Quoted 8 lines
Quoted 6 lines
Cc Eric Van Hensbergen <[email protected]>Cc Latchesar Ionkov <[email protected]>Cc Dominique Martinet <[email protected]>Cc Christian Schoenebeck <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>Reviewed-by Christian Schoenebeck <[email protected]>
Looks good to me on principle as well (and it should blow up immediately on testing in the unlikely case there's a problem...)
Eric, I don't think you have anything planned for this round? There's another data race patch laying around that we didn't submit for 6.6, shall I take these two for now?
(Assuming this patch series is meant to be taken up by individual fs maintainers independantly, it's never really clear with such large swatches of patchs and we weren't in Cc of a cover letter if there was any... In the future it'd help if either there's a clear cover letter everyone is in Cc at (some would say keep everyone in cc of all patches!), or just send these in a loop so they don't appear to be part of a series and each maintainer deals with it as they see fit)
Signature · 1 line
Dominique
Re: [PATCH 26/29] xfs: move xfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 8 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
xfs_xattr_handlersat runtime.Cc "Darrick J. Wong" <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
--D
Quoted 33 lines
--- fs/xfs/xfs_xattr.c | 2 +- fs/xfs/xfs_xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)fs/xfs/xfs_xattr.c +1
-1@@ -175,7 +175,7 @@ static const struct xattr_handler xfs_xattr_security_handler = { .set = xfs_xattr_set, }; -const struct xattr_handler *xfs_xattr_handlers[] = { +const struct xattr_handler *const xfs_xattr_handlers[] = { &xfs_xattr_user_handler, &xfs_xattr_trusted_handler, &xfs_xattr_security_handler,fs/xfs/xfs_xattr.h +1
-1@@ -8,6 +8,6 @@int xfs_attr_change (struct xfs_da_args *args); -extern const struct xattr_handler *xfs_xattr_handlers[]; +extern const struct xattr_handler *const xfs_xattr_handlers[];#endif /* __XFS_XATTR_H__ */ Signature · 1 line
2.34.1
Re: [PATCH 23/29] smb: move cifs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 47 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
cifs_xattr_handlersat runtime.Cc Steve French <[email protected]>Cc Paulo Alcantara <[email protected]>Cc Ronnie Sahlberg <[email protected]>Cc Shyam Prasad N <[email protected]>Cc Tom Talpey <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>--- fs/smb/client/cifsfs.h | 2 +- fs/smb/client/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)fs/smb/client/cifsfs.h +1
-1@@ -134,7 +134,7 @@ extern int cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, struct dentry *direntry, const char *symname);#ifdef CONFIG_CIFS_XATTR -extern const struct xattr_handler *cifs_xattr_handlers[]; +extern const struct xattr_handler *const cifs_xattr_handlers[];extern ssize_t cifs_listxattr (struct dentry *,char *,size_t );#else # define cifs_xattr_handlers NULLfs/smb/client/xattr.c +1
-2@@ -478,7 +478,7 @@ static const struct xattr_handler smb3_ntsd_full_xattr_handler = { .set = cifs_xattr_set, }; -const struct xattr_handler *cifs_xattr_handlers[] = { +const struct xattr_handler *const cifs_xattr_handlers[] = { &cifs_user_xattr_handler, &cifs_os2_xattr_handler, &cifs_cifs_acl_xattr_handler, --2.34.1
Signature · 3 lines
Thanks, Steve
Re: [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoQuoted 8 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
ext2_xattr_handlersorext2_xattr_handler_mapat runtime.Cc Jan Kara <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Looks good to me. Feel free to add:
Honza
Quoted 43 lines
--- fs/ext2/xattr.c | 4 ++-- fs/ext2/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)fs/ext2/xattr.c +2
-2@@ -98,7 +98,7 @@ static struct buffer_head *ext2_xattr_cache_find(struct inode *,static void ext2_xattr_rehash (struct ext2_xattr_header *,struct ext2_xattr_entry *); -static const struct xattr_handler *ext2_xattr_handler_map[] = { +static const struct xattr_handler *const ext2_xattr_handler_map[] = { [EXT2_XATTR_INDEX_USER ] = &ext2_xattr_user_handler, #ifdef CONFIG_EXT2_FS_POSIX_ACL [EXT2_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access,@@ -110,7 +110,7 @@ static const struct xattr_handler *ext2_xattr_handler_map[] = {#endif }; -const struct xattr_handler *ext2_xattr_handlers[] = { +const struct xattr_handler *const ext2_xattr_handlers[] = { &ext2_xattr_user_handler, &ext2_xattr_trusted_handler, #ifdef CONFIG_EXT2_FS_SECURITYfs/ext2/xattr.h +1
-1@@ -72,7 +72,7 @@ extern void ext2_xattr_delete_inode(struct inode *);extern struct mb_cache *ext2_xattr_create_cache (void );extern void ext2_xattr_destroy_cache (struct mb_cache *cache); -extern const struct xattr_handler *ext2_xattr_handlers[]; +extern const struct xattr_handler *const ext2_xattr_handlers[];# else /* CONFIG_EXT2_FS_XATTR */ Signature · 1 line
2.34.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 01/29] xattr: make the xattr array itself const
In reply to Wedson Almeida FilhoQuoted 6 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
As it is currently declared, the
xattr_handlerstructs are const but the array containing their pointers is not. This patch makes it so that fs modules can place them in .rodata, which makes it harder for accidental/malicious modifications at runtime.
You could also add an entry to scripts/const_structs.checkpatch to make sure newly introduced usages of the struct are const.
Could be a single dedicated patch after this patch has been applied.
Quoted 53 lines
Signed-off-by Wedson Almeida Filho <[email protected]>--- fs/xattr.c | 6 +++--- include/linux/fs.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)fs/xattr.c +3
-3@@ -56,7 +56,7 @@ strcmp_prefix(const char *a, const char *a_prefix)static const struct xattr_handler *xattr_resolve_name (struct inode *inode,const char **name) { -const struct xattr_handler **handlers = inode->i_sb->s_xattr; +const struct xattr_handler *const *handlers = inode->i_sb->s_xattr;const struct xattr_handler *handler;if (!(inode->i_opflags &IOP_XATTR )) {@@ -162,7 +162,7 @@ xattr_permission(struct mnt_idmap *idmap, struct inode *inode,int xattr_supports_user_prefix (struct inode *inode) { -const struct xattr_handler **handlers = inode->i_sb->s_xattr; +const struct xattr_handler *const *handlers = inode->i_sb->s_xattr;const struct xattr_handler *handler;if (!(inode->i_opflags &IOP_XATTR )) {@@ -999,7 +999,7 @@ int xattr_list_one(char **buffer, ssize_t *remaining_size, const char *name)ssize_t generic_listxattr (struct dentry *dentry,char *buffer,size_t buffer_size) { -const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; +const struct xattr_handler *handler, *const *handlers = dentry->d_sb->s_xattr;ssize_t remaining_size = buffer_size;int err =0 ;include/linux/fs.h +1
-1@@ -1172,7 +1172,7 @@ struct super_block {#ifdef CONFIG_SECURITY void *s_security;#endif -const struct xattr_handler **s_xattr; +const struct xattr_handler *const *s_xattr;#ifdef CONFIG_FS_ENCRYPTION const struct fscrypt_operations *s_cop;struct fscrypt_keyring *s_master_keys;/* master crypto keys in use */ Signature · 1 line
2.34.1
Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 10 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
btrfs_xattr_handlersat runtime.Cc Chris Mason <[email protected]>Cc Josef Bacik <[email protected]>Cc David Sterba <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
With slightly updated changelog added to misc-next, thanks.
Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
Quoted 6 lines · David Sterba
Quoted 5 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
btrfs_xattr_handlersat runtime.
Quoted 7 lines
Quoted 5 lines
Cc Chris Mason <[email protected]>Cc Josef Bacik <[email protected]>Cc David Sterba <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>With slightly updated changelog added to misc-next, thanks.
Removed again. I did not notice first that this is part of a larger series, please also CC the [PATCH 0/N] patch.
There's a warning:
fs/btrfs/super.c: In function ‘btrfs_fill_super’:fs/btrfs/super.c:1107:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1107 | sb->s_xattr = btrfs_xattr_handlers;
| ^
but the patch changing the type is present in the series.
Please update the changelog of btrfs patch with:
Add const specifier also to the pointed array members of btrfs_xattr_handlers. This moves the whole structure to the .rodata section which makes it harder for accidental or malicious changes to btrfs_xattr_handlers at runtime.
or use it for others patches too.
Christian Brauner
maintainerQuoted 11 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
The '
s_xattr' field of 'structsuper_block' currently requires a mutable table of 'structxattr_handler' entries (although each handler itself is const). However, no code in vfs actually modifies the tables.So this series changes the type of '
s_xattr' to allow const tables, and modifies existing file system to move their tables to .rodata. This is desirable because these tables contain entries with function pointers in them; moving them to .rodata makes it considerably less likely to be modified accidentally or maliciously at runtime.
Fine by me and good idea. On vacation this week but I'll wait for individual fs maintainers to ack their portions anyway and then pick up next week.
Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
In reply to David SterbaQuoted 14 lines · David Sterba
Quoted 12 lines · David Sterba
Quoted 10 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
btrfs_xattr_handlersat runtime.Cc Chris Mason <[email protected]>Cc Josef Bacik <[email protected]>Cc David Sterba <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Quoted 4 lines
Quoted 1 line
With slightly updated changelog added to misc-next, thanks.
Removed again. I did not notice first that this is part of a larger series, please also CC the [PATCH 0/N] patch.
Sorry for the confusion, I will CC you there too.
Quoted 7 lines
There's a warning:
fs/btrfs/super.c: In function ‘btrfs_fill_super’:fs/btrfs/super.c:1107:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1107 |sb->s_xattr=btrfs_xattr_handlers;
| ^
Quoted 8 lines
but the patch changing the type is present in the series.
Please update the changelog of btrfs patch with:
Add const specifier also to the pointed array members of
btrfs_xattr_handlers. This moves the whole structure to the .rodata section which makes it harder for accidental or malicious changes tobtrfs_xattr_handlersat runtime.
Will do. Thanks!
Quoted 1 line
or use it for others patches too.
Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
In reply to Dominique MartinetQuoted 17 lines · Dominique Martinet
Christian Schoenebeck wrote on Sat, Sep 30, 2023 at 10:12:25AM +0200:
Quoted 15 lines · CEST Wedson Almeida Filho
Quoted 6 lines
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
v9fs_xattr_user_handler,v9fs_xattr_trusted_handler,v9fs_xattr_security_handler, orv9fs_xattr_handlersat runtime.Quoted 6 lines
Cc Eric Van Hensbergen <[email protected]>Cc Latchesar Ionkov <[email protected]>Cc Dominique Martinet <[email protected]>Cc Christian Schoenebeck <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>Reviewed-by Christian Schoenebeck <[email protected]>
Thanks for the review, Christian!
Quoted 7 lines
Looks good to me on principle as well (and it should blow up immediately on testing in the unlikely case there's a problem...)
Eric, I don't think you have anything planned for this round? There's another data race patch laying around that we didn't submit for 6.6, shall I take these two for now?
Quoted 7 lines
(Assuming this patch series is meant to be taken up by individual fs maintainers independantly, it's never really clear with such large swatches of patchs and we weren't in Cc of a cover letter if there was any... In the future it'd help if either there's a clear cover letter everyone is in Cc at (some would say keep everyone in cc of all patches!), or just send these in a loop so they don't appear to be part of a series and each maintainer deals with it as they see fit)
There is a cover letter
(https://lore.kernel.org/all/[email protected]/),
apologies for not CCing you there. I was trying to avoid spamming maintainers with unrelated changes.
We need changes in fs/xattr.c (which are in the first patch of the series) to avoid warnings, so unfortunately this can't be taken individually. My thought was that individual fs maintainers would review/ack the patches and this would be taken through the fs tree.
Quoted 3 lines
--
Dominique
Re: [PATCH 06/29] ceph: move ceph_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 43 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
ceph_xattr_handlersat runtime.Cc Xiubo Li <[email protected]>Cc Ilya Dryomov <[email protected]>Cc Jeff Layton <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>--- fs/ceph/super.h | 2 +- fs/ceph/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)fs/ceph/super.h +1
-1@@ -1089,7 +1089,7 @@ ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t);extern ssize_t ceph_listxattr (struct dentry *,char *,size_t );extern struct ceph_buffer *__ceph_build_xattrs_blob (struct ceph_inode_info *ci);extern void __ceph_destroy_xattrs (struct ceph_inode_info *ci); -extern const struct xattr_handler *ceph_xattr_handlers[]; +extern const struct xattr_handler *const ceph_xattr_handlers[];struct ceph_acl_sec_ctx {#ifdef CONFIG_CEPH_FS_POSIX_ACL fs/ceph/xattr.c +1
-2@@ -1416,7 +1416,7 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx)* List of handlers for synthetic system.* attributes. Other * attributes are handled directly. */ -const struct xattr_handler *ceph_xattr_handlers[] = { +const struct xattr_handler *const ceph_xattr_handlers[] = { &ceph_other_xattr_handler,NULL , }; --
Quoted 2 lines
2.34.1
Thanks,
Ilya
Re: [PATCH 16/29] jfs: move jfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 8 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
jfs_xattr_handlersat runtime.Cc Dave Kleikamp <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Quoted 31 lines
--- fs/jfs/jfs_xattr.h | 2 +- fs/jfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)fs/jfs/jfs_xattr.h +1
-1@@ -46,7 +46,7 @@ extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,extern ssize_t __jfs_getxattr (struct inode *,const char *,void *,size_t );extern ssize_t jfs_listxattr (struct dentry *,char *,size_t ); -extern const struct xattr_handler *jfs_xattr_handlers[]; +extern const struct xattr_handler *const jfs_xattr_handlers[];#ifdef CONFIG_JFS_SECURITY extern int jfs_init_security(tid_t, struct inode *, struct inode *,fs/jfs/xattr.c +1
-1@@ -985,7 +985,7 @@ static const struct xattr_handler jfs_trusted_xattr_handler = { .set = jfs_xattr_set, }; -const struct xattr_handler *jfs_xattr_handlers[] = { +const struct xattr_handler *const jfs_xattr_handlers[] = { &jfs_os2_xattr_handler, &jfs_user_xattr_handler, &jfs_security_xattr_handler,
Re: [PATCH 27/29] overlayfs: move xattr tables to .rodata
In reply to Wedson Almeida FilhoQuoted 10 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
ovl_trusted_xattr_handlersorovl_user_xattr_handlersat runtime.Cc Miklos Szeredi <[email protected]>Cc Amir Goldstein <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Quoted 27 lines
--- fs/overlayfs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/overlayfs/super.c +2
-3@@ -477,13 +477,13 @@ static const struct xattr_handler ovl_other_xattr_handler = { .set = ovl_other_xattr_set, }; -static const struct xattr_handler *ovl_trusted_xattr_handlers[] = { +static const struct xattr_handler *const ovl_trusted_xattr_handlers[] = { &ovl_own_trusted_xattr_handler, &ovl_other_xattr_handler,NULL }; -static const struct xattr_handler *ovl_user_xattr_handlers[] = { +static const struct xattr_handler *const ovl_user_xattr_handlers[] = { &ovl_own_user_xattr_handler, &ovl_other_xattr_handler,NULL --2.34.1
Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
In reply to Wedson Almeida FilhoWedson Almeida Filho wrote on Tue, Oct 03, 2023 at 10:55:44AM -0300:
Quoted 20 lines
Quoted 7 lines
Looks good to me on principle as well (and it should blow up immediately on testing in the unlikely case there's a problem...)
Eric, I don't think you have anything planned for this round? There's another data race patch laying around that we didn't submit for 6.6, shall I take these two for now?
Quoted 7 lines
(Assuming this patch series is meant to be taken up by individual fs maintainers independantly, it's never really clear with such large swatches of patchs and we weren't in Cc of a cover letter if there was any... In the future it'd help if either there's a clear cover letter everyone is in Cc at (some would say keep everyone in cc of all patches!), or just send these in a loop so they don't appear to be part of a series and each maintainer deals with it as they see fit)
There is a cover letter
(https://lore.kernel.org/all/[email protected]/),
apologies for not CCing you there. I was trying to avoid spamming maintainers with unrelated changes.
Quoted 4 lines
We need changes in
fs/xattr.c(which are in the first patch of the series) to avoid warnings, so unfortunately this can't be taken individually. My thought was that individual fs maintainers would review/ack the patches and this would be taken through the fs tree.
Please include all related maintainers in cover letter and any "common"
patch: I'd have complained about the warning if I had taken the time to try it out :)
(b4 made it easy to download a whole thread, but it was't obvious this was required -- I honestly prefer receiving the whole thread than too little patch but I know some maintainers are split on this... At least I think we'll all agree cover letter and required dependencies are useful though -- I now see David Sterba told you something similar, but only after having written that so leaving it in)
By the way the shmem patch failed to apply to 6.6-rc4 and will need rebasing.
With all that said, I've taken a few minutes to check it didn't blow up, so:
Signature · 1 line
Dominique Martinet | Asmadeus
Re: [PATCH 29/29] net: move sockfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 4 lines · On Sat, 30 Sep 2023 02:00:33 -0300 Wedson Almeida Filho wrote:
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
sockfs_xattr_handlersat runtime.
Re: [PATCH 17/29] kernfs: move kernfs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 8 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
kernfs_xattr_handlersat runtime.Cc Greg Kroah-Hartman <[email protected]>Cc Tejun Heo <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Re: [PATCH 25/29] ubifs: move ubifs_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 5 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
ubifs_xattr_handlersat runtime.
Quoted 7 lines
Cc Richard Weinberger <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>--- fs/ubifs/ubifs.h | 2 +- fs/ubifs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 28 lines
fs/ubifs/ubifs.h +1
-1@@ -2043,7 +2043,7 @@ ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf, size_t size);#ifdef CONFIG_UBIFS_FS_XATTR -extern const struct xattr_handler *ubifs_xattr_handlers[]; +extern const struct xattr_handler *const ubifs_xattr_handlers[];ssize_t ubifs_listxattr (struct dentry *dentry,char *buffer,size_t size);void ubifs_evict_xattr_inode (struct ubifs_info *c,ino_t xattr_inum);int ubifs_purge_xattrs (struct inode *host);fs/ubifs/xattr.c +1
-1@@ -735,7 +735,7 @@ static const struct xattr_handler ubifs_security_xattr_handler = { };#endif -const struct xattr_handler *ubifs_xattr_handlers[] = { +const struct xattr_handler *const ubifs_xattr_handlers[] = { &ubifs_user_xattr_handler, &ubifs_trusted_xattr_handler, #ifdef CONFIG_UBIFS_FS_SECURITY
Re: [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata
In reply to Wedson Almeida FilhoQuoted 5 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
jffs2_xattr_handlersat runtime.
Quoted 9 lines
Cc David Woodhouse <[email protected]>Cc Richard Weinberger <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>--- fs/jffs2/xattr.c | 2 +- fs/jffs2/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 27 lines
fs/jffs2/xattr.c +1
-1@@ -920,7 +920,7 @@ struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,* do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags) * is an implementation of setxattr handler on jffs2. * -------------------------------------------------- */ -const struct xattr_handler *jffs2_xattr_handlers[] = { +const struct xattr_handler *const jffs2_xattr_handlers[] = { &jffs2_user_xattr_handler, #ifdef CONFIG_JFFS2_FS_SECURITY &jffs2_security_xattr_handler,fs/jffs2/xattr.h +1
-1@@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xnameextern int do_jffs2_setxattr (struct inode *inode,int xprefix,const char *xname,const char *buffer,size_t size,int flags); -extern const struct xattr_handler *jffs2_xattr_handlers[]; +extern const struct xattr_handler *const jffs2_xattr_handlers[];extern const struct xattr_handler jffs2_user_xattr_handler;extern const struct xattr_handler jffs2_trusted_xattr_handler;
Re: [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoQuoted 11 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
erofs_xattr_handlersorxattr_handler_mapat runtime.Cc Gao Xiang <[email protected]>Cc Chao Yu <[email protected]>Cc Yue Hu <[email protected]>Cc Jeffle Xu <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Thanks,
Gao Xiang
Re: [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
In reply to Wedson Almeida FilhoQuoted 9 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
This makes it harder for accidental or malicious changes to
f2fs_xattr_handlersorf2fs_xattr_handler_mapat runtime.Cc Jaegeuk Kim <[email protected]>Cc Chao Yu <[email protected]>Signed-off-by Wedson Almeida Filho <[email protected]>
Thanks,
Quoted 6 lines · Wedson Almeida Filho
From: Wedson Almeida Filho <[email protected]>
The '
s_xattr' field of 'structsuper_block' currently requires a mutable table of 'structxattr_handler' entries (although each handler itself is const). However, no code in vfs actually modifies the tables.
Quoted 7 lines
So this series changes the type of '
s_xattr' to allow const tables, and modifies existing file system to move their tables to .rodata. This is desirable because these tables contain entries with function pointers in them; moving them to .rodata makes it considerably less likely to be modified accidentally or maliciously at runtime.I found this while writing Rust abstractions for vfs.
Applied to the vfs.xattr branch of the vfs/vfs.git tree. Patches in the vfs.xattr branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.xattr
[01/29] xattr: make the xattr array itself const
https://git.kernel.org/vfs/vfs/c/e346fb6d774a [02/29] ext4: move ext4_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/e60ac1283340 [03/29] 9p: move xattr-related structs to .rodata https://git.kernel.org/vfs/vfs/c/b6079dc9cb51 [04/29] afs: move afs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/f710c2e48135 [05/29] btrfs: move btrfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/8a25b4189896 [06/29] ceph: move ceph_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/10f9fbe9f25a [07/29] ecryptfs: move ecryptfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/f354ed981066 [08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/3591f40e223c [09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/ce78a1ec1c3b [10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/a1c0752c33d2 [11/29] fuse: move fuse_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/34271edb1878 [12/29] gfs2: move gfs2_xattr_handlers_max to .rodata https://git.kernel.org/vfs/vfs/c/89491fafa81c [13/29] hfs: move hfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/e27a45b65070 [14/29] hfsplus: move hfsplus_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/2c323f2c5650 [15/29] jffs2: move jffs2_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/13a75c3abcbe [16/29] jfs: move jfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/ea780283e2c0 [17/29] kernfs: move kernfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/ffb2e0650827 [18/29] nfs: move nfs4_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/f496647e3b09 [19/29] ntfs3: move ntfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/5bf1dd9441da [20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/2cba9af99b3f [21/29] orangefs: move orangefs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/2e9440ac0716 [22/29] reiserfs: move reiserfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/c063254b7de8 [23/29] smb: move cifs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/e45679b0d2e4 [24/29] squashfs: move squashfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/8a2ae79c7db0 [25/29] ubifs: move ubifs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/582f1ebe32a9 [26/29] xfs: move xfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/6fca42a3b168 [27/29] overlayfs: move xattr tables to .rodata https://git.kernel.org/vfs/vfs/c/3f644c1cd7b5 [28/29] shmem: move shmem_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/2f8e5f98045e [29/29] net: move sockfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/dcff22588d9a