All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/29] const xattr tables
@ 2023-09-30  5:00 Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 01/29] xattr: make the xattr array itself const Wedson Almeida Filho
                   ` (30 more replies)
  0 siblings, 31 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

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
-- 
2.34.1


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

* [PATCH 01/29] xattr: make the xattr array itself const
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  6:54   ` kernel test robot
  2023-10-02  9:58   ` Thomas Weißschuh
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
                   ` (29 subsequent siblings)
  30 siblings, 2 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

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.

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/xattr.c         | 6 +++---
 include/linux/fs.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index e7bbb7f57557..1905f8ede13d 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -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;
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 562f2623c9c9..4d8003f48216 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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 */
-- 
2.34.1


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

* [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 01/29] xattr: make the xattr array itself const Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 03/29] 9p: move xattr-related structs " Wedson Almeida Filho
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Theodore Ts'o,
	Andreas Dilger, linux-ext4

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ext4_xattr_handlers at runtime.

Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ext4/xattr.c | 2 +-
 fs/ext4/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 05151d61b00b..5e8a7328fe4e 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -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
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 824faf0b15a8..bd97c4aa8177 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 03/29] 9p: move xattr-related structs to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 01/29] xattr: make the xattr array itself const Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  8:12   ` Christian Schoenebeck
  2023-09-30  5:00 ` [PATCH 04/29] afs: move afs_xattr_handlers " Wedson Almeida Filho
                   ` (27 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
	v9fs

From: Wedson Almeida Filho <walmeida@microsoft.com>

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.

Cc: Eric Van Hensbergen <ericvh@kernel.org>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: Dominique Martinet <asmadeus@codewreck.org>
Cc: Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: v9fs@lists.linux.dev
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/9p/xattr.c | 8 ++++----
 fs/9p/xattr.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index e00cf8109b3f..053d1cef6e13 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -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
diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h
index b5636e544c8a..3ad5a802352a 100644
--- a/fs/9p/xattr.h
+++ b/fs/9p/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 04/29] afs: move afs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (2 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 03/29] 9p: move xattr-related structs " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 05/29] btrfs: move btrfs_xattr_handlers " Wedson Almeida Filho
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, David Howells, Marc Dionne,
	linux-afs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
afs_xattr_handlers at runtime.

Cc: David Howells <dhowells@redhat.com>
Cc: Marc Dionne <marc.dionne@auristor.com>
Cc: linux-afs@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/afs/internal.h | 2 +-
 fs/afs/xattr.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 9d3d64921106..a01d1f71ae8c 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -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
diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c
index 9048d8ccc715..64b2c0224f62 100644
--- a/fs/afs/xattr.c
+++ b/fs/afs/xattr.c
@@ -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,
-- 
2.34.1


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

* [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (3 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 04/29] afs: move afs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-02 11:28   ` David Sterba
  2023-09-30  5:00 ` [PATCH 06/29] ceph: move ceph_xattr_handlers " Wedson Almeida Filho
                   ` (25 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Chris Mason, Josef Bacik,
	David Sterba, linux-btrfs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
btrfs_xattr_handlers at runtime.

Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/btrfs/xattr.c | 2 +-
 fs/btrfs/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index fc4b20c2688a..d82d9545386a 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -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,
diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h
index 1cd3fc0a8f17..118118ca3e1d 100644
--- a/fs/btrfs/xattr.h
+++ b/fs/btrfs/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 06/29] ceph: move ceph_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (4 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 05/29] btrfs: move btrfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-03 14:30   ` Ilya Dryomov
  2023-09-30  5:00 ` [PATCH 07/29] ecryptfs: move ecryptfs_xattr_handlers " Wedson Almeida Filho
                   ` (24 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Xiubo Li, Ilya Dryomov,
	Jeff Layton, ceph-devel

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ceph_xattr_handlers at runtime.

Cc: Xiubo Li <xiubli@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: ceph-devel@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ceph/super.h | 2 +-
 fs/ceph/xattr.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 3bfddf34d488..b40be1a0f778 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -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
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 806183959c47..0350d7465bbb 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -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,
 };
-- 
2.34.1


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

* [PATCH 07/29] ecryptfs: move ecryptfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (5 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 06/29] ceph: move ceph_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00   ` Wedson Almeida Filho
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Tyler Hicks, ecryptfs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ecryptfs_xattr_handlers at runtime.

Cc: Tyler Hicks <code@tyhicks.com>
Cc: ecryptfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ecryptfs/ecryptfs_kernel.h | 2 +-
 fs/ecryptfs/inode.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index f2ed0c0266cb..c586c5db18b5 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -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 */
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 83274915ba6d..18fcec208d9d 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -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
 };
-- 
2.34.1


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

* [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, linux-erofs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
erofs_xattr_handlers or xattr_handler_map at runtime.

Cc: Gao Xiang <xiang@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Cc: Yue Hu <huyue2@coolpad.com>
Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/erofs/xattr.c | 2 +-
 fs/erofs/xattr.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index 40178b6e0688..a6dd68ea5df2 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -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
diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h
index f16283cb8c93..b246cd0e135e 100644
--- a/fs/erofs/xattr.h
+++ b/fs/erofs/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  0 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Yue Hu, linux-erofs, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
erofs_xattr_handlers or xattr_handler_map at runtime.

Cc: Gao Xiang <xiang@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Cc: Yue Hu <huyue2@coolpad.com>
Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/erofs/xattr.c | 2 +-
 fs/erofs/xattr.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index 40178b6e0688..a6dd68ea5df2 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -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
diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h
index f16283cb8c93..b246cd0e135e 100644
--- a/fs/erofs/xattr.h
+++ b/fs/erofs/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (7 preceding siblings ...)
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-02  9:49   ` Jan Kara
  2023-09-30  5:00   ` Wedson Almeida Filho
                   ` (21 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Jan Kara, linux-ext4

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ext2_xattr_handlers or ext2_xattr_handler_map at runtime.

Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ext2/xattr.c | 4 ++--
 fs/ext2/xattr.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 8906ba479aaf..cfbe376da612 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -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
diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h
index 7925f596e8e2..6a4966949047 100644
--- a/fs/ext2/xattr.h
+++ b/fs/ext2/xattr.h
@@ -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 */
 
-- 
2.34.1


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

* [f2fs-dev] [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: Jaegeuk Kim, linux-f2fs-devel, linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
f2fs_xattr_handlers or f2fs_xattr_handler_map at runtime.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/f2fs/xattr.c | 4 ++--
 fs/f2fs/xattr.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 476b186b90a6..3895a066f36c 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -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
diff --git a/fs/f2fs/xattr.h b/fs/f2fs/xattr.h
index b1811c392e6f..a005ffdcf717 100644
--- a/fs/f2fs/xattr.h
+++ b/fs/f2fs/xattr.h
@@ -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);
-- 
2.34.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  0 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Jaegeuk Kim, Chao Yu,
	linux-f2fs-devel

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
f2fs_xattr_handlers or f2fs_xattr_handler_map at runtime.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/f2fs/xattr.c | 4 ++--
 fs/f2fs/xattr.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 476b186b90a6..3895a066f36c 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -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
diff --git a/fs/f2fs/xattr.h b/fs/f2fs/xattr.h
index b1811c392e6f..a005ffdcf717 100644
--- a/fs/f2fs/xattr.h
+++ b/fs/f2fs/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 11/29] fuse: move fuse_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (9 preceding siblings ...)
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00   ` [Cluster-devel] " Wedson Almeida Filho
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Miklos Szeredi

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
fuse_xattr_handlers at runtime.

Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/fuse/fuse_i.h | 2 +-
 fs/fuse/xattr.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 9b7fc7d3c7f1..2e8c2e06cf78 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -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);
diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c
index 49c01559580f..5b423fdbb13f 100644
--- a/fs/fuse/xattr.c
+++ b/fs/fuse/xattr.c
@@ -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
 };
-- 
2.34.1


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

* [PATCH 12/29] gfs2: move gfs2_xattr_handlers_max to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Bob Peterson,
	Andreas Gruenbacher, cluster-devel

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
gfs2_xattr_handlers_max at runtime.

Cc: Bob Peterson <rpeterso@redhat.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: cluster-devel@redhat.com
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/gfs2/super.h | 4 ++--
 fs/gfs2/xattr.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h
index bba58629bc45..3555dc69183a 100644
--- a/fs/gfs2/super.h
+++ b/fs/gfs2/super.h
@@ -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__ */
 
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 93b36d026bb4..146c32d44bd1 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -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;
-- 
2.34.1


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

* [Cluster-devel] [PATCH 12/29] gfs2: move gfs2_xattr_handlers_max to .rodata
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  0 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: cluster-devel, linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
gfs2_xattr_handlers_max at runtime.

Cc: Bob Peterson <rpeterso@redhat.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: cluster-devel@redhat.com
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/gfs2/super.h | 4 ++--
 fs/gfs2/xattr.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h
index bba58629bc45..3555dc69183a 100644
--- a/fs/gfs2/super.h
+++ b/fs/gfs2/super.h
@@ -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__ */
 
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 93b36d026bb4..146c32d44bd1 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -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;
-- 
2.34.1


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

* [PATCH 13/29] hfs: move hfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (11 preceding siblings ...)
  2023-09-30  5:00   ` [Cluster-devel] " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 14/29] hfsplus: move hfsplus_xattr_handlers " Wedson Almeida Filho
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
hfs_xattr_handlers at runtime.

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/hfs/attr.c   | 2 +-
 fs/hfs/hfs_fs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c
index 6341bb248247..f8395cdd1adf 100644
--- a/fs/hfs/attr.c
+++ b/fs/hfs/attr.c
@@ -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
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 49d02524e667..b5a6ad5df357 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -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 *);
-- 
2.34.1


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

* [PATCH 14/29] hfsplus: move hfsplus_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (12 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 13/29] hfs: move hfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00   ` Wedson Almeida Filho
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
hfsplus_xattr_handlers at runtime.

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/hfsplus/xattr.c | 2 +-
 fs/hfsplus/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index 58021e73c00b..9c9ff6b8c6f7 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -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,
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h
index d14e362b3eba..15cc55e41410 100644
--- a/fs/hfsplus/xattr.h
+++ b/fs/hfsplus/xattr.h
@@ -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);
-- 
2.34.1


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

* [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, David Woodhouse,
	Richard Weinberger, linux-mtd

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
jffs2_xattr_handlers at runtime.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/jffs2/xattr.c | 2 +-
 fs/jffs2/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 3b6bdc9a49e1..00224f3a8d6e 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -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,
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 1b5030a3349d..7e7de093ec0a 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
 extern 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;
 
-- 
2.34.1


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

* [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  0 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, David Woodhouse,
	Richard Weinberger, linux-mtd

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
jffs2_xattr_handlers at runtime.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/jffs2/xattr.c | 2 +-
 fs/jffs2/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 3b6bdc9a49e1..00224f3a8d6e 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -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,
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 1b5030a3349d..7e7de093ec0a 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
 extern 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;
 
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 16/29] jfs: move jfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (14 preceding siblings ...)
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-03 14:54   ` Dave Kleikamp
  2023-09-30  5:00 ` [PATCH 17/29] kernfs: move kernfs_xattr_handlers " Wedson Almeida Filho
                   ` (14 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Dave Kleikamp, jfs-discussion

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
jfs_xattr_handlers at runtime.

Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: jfs-discussion@lists.sourceforge.net
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/jfs/jfs_xattr.h | 2 +-
 fs/jfs/xattr.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h
index 0d33816d251d..ec67d8554d2c 100644
--- a/fs/jfs/jfs_xattr.h
+++ b/fs/jfs/jfs_xattr.h
@@ -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 *,
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 931e50018f88..001c900a2b4d 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -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,
-- 
2.34.1


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

* [PATCH 17/29] kernfs: move kernfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (15 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 16/29] jfs: move jfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-05 10:37   ` Greg Kroah-Hartman
  2023-09-30  5:00 ` [PATCH 18/29] nfs: move nfs4_xattr_handlers " Wedson Almeida Filho
                   ` (13 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Greg Kroah-Hartman, Tejun Heo

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
kernfs_xattr_handlers at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/kernfs/inode.c           | 2 +-
 fs/kernfs/kernfs-internal.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index b22b74d1a115..45a63c4e5e4e 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -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,
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index a9b854cdfdb5..237f2764b941 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -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);
-- 
2.34.1


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

* [PATCH 18/29] nfs: move nfs4_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (16 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 17/29] kernfs: move kernfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 19/29] ntfs3: move ntfs_xattr_handlers " Wedson Almeida Filho
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Trond Myklebust,
	Anna Schumaker, linux-nfs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
nfs4_xattr_handlers at runtime.

Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/nfs/nfs.h      | 2 +-
 fs/nfs/nfs4_fs.h  | 2 +-
 fs/nfs/nfs4proc.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h
index 5ba00610aede..0d3ce0460e35 100644
--- a/fs/nfs/nfs.h
+++ b/fs/nfs/nfs.h
@@ -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 */
 };
 
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 4c9f8bd866ab..28499a0da4c3 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -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,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 832fa226b8f2..4557a14a596c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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,
-- 
2.34.1


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

* [PATCH 19/29] ntfs3: move ntfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (17 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 18/29] nfs: move nfs4_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map " Wedson Almeida Filho
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Konstantin Komarov, ntfs3

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ntfs_xattr_handlers at runtime.

Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ntfs3/ntfs_fs.h | 2 +-
 fs/ntfs3/xattr.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 629403ede6e5..41c1538f8e51 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -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);
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 023f314e8950..a67ff036a251 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -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,
 };
-- 
2.34.1


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

* [PATCH 20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (18 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 19/29] ntfs3: move ntfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 21/29] orangefs: move orangefs_xattr_handlers " Wedson Almeida Filho
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Mark Fasheh, Joel Becker,
	Joseph Qi, ocfs2-devel

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ocfs2_xattr_handlers or ocfs2_xattr_handler_map at runtime.

Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: ocfs2-devel@lists.linux.dev
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ocfs2/xattr.c | 4 ++--
 fs/ocfs2/xattr.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 4ac77ff6e676..1c54adac1e50 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -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,
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
index 00308b57f64f..65e9aa743919 100644
--- a/fs/ocfs2/xattr.h
+++ b/fs/ocfs2/xattr.h
@@ -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,
-- 
2.34.1


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

* [PATCH 21/29] orangefs: move orangefs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (19 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 22/29] reiserfs: move reiserfs_xattr_handlers " Wedson Almeida Filho
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Mike Marshall,
	Martin Brandenburg, devel

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
orangefs_xattr_handlers at runtime.

Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Martin Brandenburg <martin@omnibond.com>
Cc: devel@lists.orangefs.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/orangefs/orangefs-kernel.h | 2 +-
 fs/orangefs/xattr.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index ce20d3443869..e211f29544e5 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -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,
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c
index 68b62689a63e..74ef75586f38 100644
--- a/fs/orangefs/xattr.c
+++ b/fs/orangefs/xattr.c
@@ -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
 };
-- 
2.34.1


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

* [PATCH 22/29] reiserfs: move reiserfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (20 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 21/29] orangefs: move orangefs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 23/29] smb: move cifs_xattr_handlers " Wedson Almeida Filho
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, reiserfs-devel

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
reiserfs_xattr_handlers at runtime.

Cc: reiserfs-devel@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/reiserfs/reiserfs.h | 2 +-
 fs/reiserfs/xattr.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 55e85256aae8..c18d0bc01725 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -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
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 651027967159..5a22a2bdaec7 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -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,
-- 
2.34.1


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

* [PATCH 23/29] smb: move cifs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (21 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 22/29] reiserfs: move reiserfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-01 19:59   ` Steve French
  2023-09-30  5:00 ` [PATCH 24/29] squashfs: move squashfs_xattr_handlers " Wedson Almeida Filho
                   ` (7 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Steve French,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
	linux-cifs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
cifs_xattr_handlers at runtime.

Cc: Steve French <sfrench@samba.org>
Cc: Paulo Alcantara <pc@manguebit.com>
Cc: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: Shyam Prasad N <sprasad@microsoft.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/smb/client/cifsfs.h | 2 +-
 fs/smb/client/xattr.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h
index 15c8cc4b6680..a0472b539567 100644
--- a/fs/smb/client/cifsfs.h
+++ b/fs/smb/client/cifsfs.h
@@ -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
diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c
index 4ad5531686d8..ac199160bce6 100644
--- a/fs/smb/client/xattr.c
+++ b/fs/smb/client/xattr.c
@@ -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


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

* [PATCH 24/29] squashfs: move squashfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (22 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 23/29] smb: move cifs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00   ` Wedson Almeida Filho
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Phillip Lougher

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
squashfs_xattr_handlers at runtime.

Cc: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/squashfs/squashfs.h | 2 +-
 fs/squashfs/xattr.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
index a6164fdf9435..5a756e6790b5 100644
--- a/fs/squashfs/squashfs.h
+++ b/fs/squashfs/squashfs.h
@@ -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[];
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index e1e3f3dd5a06..ce6608cabd49 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -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,
-- 
2.34.1


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

* [PATCH 25/29] ubifs: move ubifs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Richard Weinberger, linux-mtd

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ubifs_xattr_handlers at runtime.

Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ubifs/ubifs.h | 2 +-
 fs/ubifs/xattr.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 4c36044140e7..8a9a66255e7e 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -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);
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 349228dd1191..5e17e9591e6e 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -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
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 25/29] ubifs: move ubifs_xattr_handlers to .rodata
@ 2023-09-30  5:00   ` Wedson Almeida Filho
  0 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Richard Weinberger, linux-mtd

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ubifs_xattr_handlers at runtime.

Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ubifs/ubifs.h | 2 +-
 fs/ubifs/xattr.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 4c36044140e7..8a9a66255e7e 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -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);
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 349228dd1191..5e17e9591e6e 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -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
-- 
2.34.1


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

* [PATCH 26/29] xfs: move xfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (24 preceding siblings ...)
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-01 16:18   ` Darrick J. Wong
  2023-09-30  5:00 ` [PATCH 27/29] overlayfs: move xattr tables " Wedson Almeida Filho
                   ` (4 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Darrick J. Wong, linux-xfs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
xfs_xattr_handlers at runtime.

Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/xfs/xfs_xattr.c | 2 +-
 fs/xfs/xfs_xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 43e5c219aaed..77418bcd6f3a 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -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,
diff --git a/fs/xfs/xfs_xattr.h b/fs/xfs/xfs_xattr.h
index 2b09133b1b9b..cec766cad26c 100644
--- a/fs/xfs/xfs_xattr.h
+++ b/fs/xfs/xfs_xattr.h
@@ -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__ */
-- 
2.34.1


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

* [PATCH 27/29] overlayfs: move xattr tables to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (25 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 26/29] xfs: move xfs_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-03 16:41   ` Amir Goldstein
  2023-09-30  5:00 ` [PATCH 28/29] shmem: move shmem_xattr_handlers " Wedson Almeida Filho
                   ` (3 subsequent siblings)
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Miklos Szeredi,
	Amir Goldstein, linux-unionfs

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ovl_trusted_xattr_handlers or ovl_user_xattr_handlers at runtime.

Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: linux-unionfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/overlayfs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index cc8977498c48..fe7af47be621 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -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


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

* [PATCH 28/29] shmem: move shmem_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (26 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 27/29] overlayfs: move xattr tables " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 29/29] net: move sockfs_xattr_handlers " Wedson Almeida Filho
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Hugh Dickins, Andrew Morton,
	linux-mm

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
shmem_xattr_handlers at runtime.

Cc: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index d963c747dabc..683c84d667c1 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -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
-- 
2.34.1


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

* [PATCH 29/29] net: move sockfs_xattr_handlers to .rodata
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (27 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 28/29] shmem: move shmem_xattr_handlers " Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-04 21:24   ` Jakub Kicinski
  2023-10-03 13:28 ` [PATCH 00/29] const xattr tables Christian Brauner
  2023-10-09 14:43 ` Christian Brauner
  30 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Richard Cochran,
	netdev

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
sockfs_xattr_handlers at runtime.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 include/linux/pseudo_fs.h | 2 +-
 net/socket.c              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/pseudo_fs.h b/include/linux/pseudo_fs.h
index eceda1d1407a..730f77381d55 100644
--- a/include/linux/pseudo_fs.h
+++ b/include/linux/pseudo_fs.h
@@ -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;
 };
diff --git a/net/socket.c b/net/socket.c
index 2b0e54b2405c..0a99fc22641e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -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
-- 
2.34.1


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

* Re: [PATCH 01/29] xattr: make the xattr array itself const
  2023-09-30  5:00 ` [PATCH 01/29] xattr: make the xattr array itself const Wedson Almeida Filho
@ 2023-09-30  6:54   ` kernel test robot
  2023-10-02  9:58   ` Thomas Weißschuh
  1 sibling, 0 replies; 62+ messages in thread
From: kernel test robot @ 2023-09-30  6:54 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: oe-kbuild-all, linux-kernel, Wedson Almeida Filho

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/202309301437.ZGtqFntR-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/202309301437.ZGtqFntR-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309301437.ZGtqFntR-lkp@intel.com/

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  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
  2023-09-30  5:00 ` [PATCH 03/29] 9p: move xattr-related structs " Wedson Almeida Filho
@ 2023-09-30  8:12   ` Christian Schoenebeck
  2023-09-30  9:03     ` Dominique Martinet
  0 siblings, 1 reply; 62+ messages in thread
From: Christian Schoenebeck @ 2023-09-30  8:12 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel, Wedson Almeida Filho
  Cc: linux-kernel, Wedson Almeida Filho, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, v9fs

On Saturday, September 30, 2023 7:00:07 AM CEST Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> 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.
> 
> Cc: Eric Van Hensbergen <ericvh@kernel.org>
> Cc: Latchesar Ionkov <lucho@ionkov.net>
> Cc: Dominique Martinet <asmadeus@codewreck.org>
> Cc: Christian Schoenebeck <linux_oss@crudebyte.com>
> Cc: v9fs@lists.linux.dev
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>

> ---
>  fs/9p/xattr.c | 8 ++++----
>  fs/9p/xattr.h | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
> index e00cf8109b3f..053d1cef6e13 100644
> --- a/fs/9p/xattr.c
> +++ b/fs/9p/xattr.c
> @@ -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
> diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h
> index b5636e544c8a..3ad5a802352a 100644
> --- a/fs/9p/xattr.h
> +++ b/fs/9p/xattr.h
> @@ -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);
> 



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

* Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
  2023-09-30  8:12   ` Christian Schoenebeck
@ 2023-09-30  9:03     ` Dominique Martinet
  2023-10-03 13:55       ` Wedson Almeida Filho
  0 siblings, 1 reply; 62+ messages in thread
From: Dominique Martinet @ 2023-09-30  9:03 UTC (permalink / raw)
  To: Eric Van Hensbergen
  Cc: Christian Schoenebeck, Alexander Viro, Christian Brauner,
	linux-fsdevel, Wedson Almeida Filho, linux-kernel,
	Wedson Almeida Filho, Latchesar Ionkov, v9fs

Christian Schoenebeck wrote on Sat, Sep 30, 2023 at 10:12:25AM +0200:
> On Saturday, September 30, 2023 7:00:07 AM CEST Wedson Almeida Filho wrote:
> > From: Wedson Almeida Filho <walmeida@microsoft.com>
> > 
> > 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.
> > 
> > Cc: Eric Van Hensbergen <ericvh@kernel.org>
> > Cc: Latchesar Ionkov <lucho@ionkov.net>
> > Cc: Dominique Martinet <asmadeus@codewreck.org>
> > Cc: Christian Schoenebeck <linux_oss@crudebyte.com>
> > Cc: v9fs@lists.linux.dev
> > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>

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)

-- 
Dominique

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

* Re: [PATCH 26/29] xfs: move xfs_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 26/29] xfs: move xfs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-01 16:18   ` Darrick J. Wong
  0 siblings, 0 replies; 62+ messages in thread
From: Darrick J. Wong @ 2023-10-01 16:18 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, linux-xfs

On Sat, Sep 30, 2023 at 02:00:30AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> xfs_xattr_handlers at runtime.
> 
> Cc: "Darrick J. Wong" <djwong@kernel.org>
> Cc: linux-xfs@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_xattr.c | 2 +-
>  fs/xfs/xfs_xattr.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
> index 43e5c219aaed..77418bcd6f3a 100644
> --- a/fs/xfs/xfs_xattr.c
> +++ b/fs/xfs/xfs_xattr.c
> @@ -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,
> diff --git a/fs/xfs/xfs_xattr.h b/fs/xfs/xfs_xattr.h
> index 2b09133b1b9b..cec766cad26c 100644
> --- a/fs/xfs/xfs_xattr.h
> +++ b/fs/xfs/xfs_xattr.h
> @@ -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__ */
> -- 
> 2.34.1
> 

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

* Re: [PATCH 23/29] smb: move cifs_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 23/29] smb: move cifs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-01 19:59   ` Steve French
  0 siblings, 0 replies; 62+ messages in thread
From: Steve French @ 2023-10-01 19:59 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Steve French, Paulo Alcantara,
	Ronnie Sahlberg, Shyam Prasad N, Tom Talpey, linux-cifs

Reviewed-by: Steve French <stfrench@microsoft.com>

On Sat, Sep 30, 2023 at 6:27 AM Wedson Almeida Filho <wedsonaf@gmail.com> wrote:
>
> From: Wedson Almeida Filho <walmeida@microsoft.com>
>
> This makes it harder for accidental or malicious changes to
> cifs_xattr_handlers at runtime.
>
> Cc: Steve French <sfrench@samba.org>
> Cc: Paulo Alcantara <pc@manguebit.com>
> Cc: Ronnie Sahlberg <lsahlber@redhat.com>
> Cc: Shyam Prasad N <sprasad@microsoft.com>
> Cc: Tom Talpey <tom@talpey.com>
> Cc: linux-cifs@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>  fs/smb/client/cifsfs.h | 2 +-
>  fs/smb/client/xattr.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h
> index 15c8cc4b6680..a0472b539567 100644
> --- a/fs/smb/client/cifsfs.h
> +++ b/fs/smb/client/cifsfs.h
> @@ -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
> diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c
> index 4ad5531686d8..ac199160bce6 100644
> --- a/fs/smb/client/xattr.c
> +++ b/fs/smb/client/xattr.c
> @@ -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
>


-- 
Thanks,

Steve

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

* Re: [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
  2023-09-30  5:00 ` [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map " Wedson Almeida Filho
@ 2023-10-02  9:49   ` Jan Kara
  0 siblings, 0 replies; 62+ messages in thread
From: Jan Kara @ 2023-10-02  9:49 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Jan Kara, linux-ext4

On Sat 30-09-23 02:00:13, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> ext2_xattr_handlers or ext2_xattr_handler_map at runtime.
> 
> Cc: Jan Kara <jack@suse.com>
> Cc: linux-ext4@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Looks good to me. Feel free to add:

Acked-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext2/xattr.c | 4 ++--
>  fs/ext2/xattr.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> index 8906ba479aaf..cfbe376da612 100644
> --- a/fs/ext2/xattr.c
> +++ b/fs/ext2/xattr.c
> @@ -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
> diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h
> index 7925f596e8e2..6a4966949047 100644
> --- a/fs/ext2/xattr.h
> +++ b/fs/ext2/xattr.h
> @@ -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 */
>  
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH 01/29] xattr: make the xattr array itself const
  2023-09-30  5:00 ` [PATCH 01/29] xattr: make the xattr array itself const Wedson Almeida Filho
  2023-09-30  6:54   ` kernel test robot
@ 2023-10-02  9:58   ` Thomas Weißschuh
  1 sibling, 0 replies; 62+ messages in thread
From: Thomas Weißschuh @ 2023-10-02  9:58 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho

On 2023-09-30 02:00:05-0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> 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.

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.

> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>  fs/xattr.c         | 6 +++---
>  include/linux/fs.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xattr.c b/fs/xattr.c
> index e7bbb7f57557..1905f8ede13d 100644
> --- a/fs/xattr.c
> +++ b/fs/xattr.c
> @@ -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;
>  
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 562f2623c9c9..4d8003f48216 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -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 */
> -- 
> 2.34.1
> 

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

* Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 05/29] btrfs: move btrfs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-02 11:28   ` David Sterba
  2023-10-02 11:37     ` David Sterba
  0 siblings, 1 reply; 62+ messages in thread
From: David Sterba @ 2023-10-02 11:28 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Chris Mason, Josef Bacik, David Sterba,
	linux-btrfs

On Sat, Sep 30, 2023 at 02:00:09AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> btrfs_xattr_handlers at runtime.
> 
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <josef@toxicpanda.com>
> Cc: David Sterba <dsterba@suse.com>
> Cc: linux-btrfs@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

With slightly updated changelog added to misc-next, thanks.

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

* Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
  2023-10-02 11:28   ` David Sterba
@ 2023-10-02 11:37     ` David Sterba
  2023-10-03 13:48       ` Wedson Almeida Filho
  0 siblings, 1 reply; 62+ messages in thread
From: David Sterba @ 2023-10-02 11:37 UTC (permalink / raw)
  To: David Sterba
  Cc: Wedson Almeida Filho, Alexander Viro, Christian Brauner,
	linux-fsdevel, linux-kernel, Wedson Almeida Filho, Chris Mason,
	Josef Bacik, David Sterba, linux-btrfs

On Mon, Oct 02, 2023 at 01:28:58PM +0200, David Sterba wrote:
> On Sat, Sep 30, 2023 at 02:00:09AM -0300, Wedson Almeida Filho wrote:
> > From: Wedson Almeida Filho <walmeida@microsoft.com>
> > 
> > This makes it harder for accidental or malicious changes to
> > btrfs_xattr_handlers at runtime.
> > 
> > Cc: Chris Mason <clm@fb.com>
> > Cc: Josef Bacik <josef@toxicpanda.com>
> > Cc: David Sterba <dsterba@suse.com>
> > Cc: linux-btrfs@vger.kernel.org
> > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> 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.

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

* Re: [PATCH 00/29] const xattr tables
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (28 preceding siblings ...)
  2023-09-30  5:00 ` [PATCH 29/29] net: move sockfs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-03 13:28 ` Christian Brauner
  2023-10-09 14:43 ` Christian Brauner
  30 siblings, 0 replies; 62+ messages in thread
From: Christian Brauner @ 2023-10-03 13:28 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, linux-fsdevel, linux-kernel, Wedson Almeida Filho

On Sat, Sep 30, 2023 at 02:00:04AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> 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.

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.

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

* Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
  2023-10-02 11:37     ` David Sterba
@ 2023-10-03 13:48       ` Wedson Almeida Filho
  0 siblings, 0 replies; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-10-03 13:48 UTC (permalink / raw)
  To: dsterba
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Chris Mason, Josef Bacik, David Sterba,
	linux-btrfs

On Mon, 2 Oct 2023 at 08:44, David Sterba <dsterba@suse.cz> wrote:
>
> On Mon, Oct 02, 2023 at 01:28:58PM +0200, David Sterba wrote:
> > On Sat, Sep 30, 2023 at 02:00:09AM -0300, Wedson Almeida Filho wrote:
> > > From: Wedson Almeida Filho <walmeida@microsoft.com>
> > >
> > > This makes it harder for accidental or malicious changes to
> > > btrfs_xattr_handlers at runtime.
> > >
> > > Cc: Chris Mason <clm@fb.com>
> > > Cc: Josef Bacik <josef@toxicpanda.com>
> > > Cc: David Sterba <dsterba@suse.com>
> > > Cc: linux-btrfs@vger.kernel.org
> > > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> >
> > 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.

> 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.

Will do. Thanks!

> or use it for others patches too.

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

* Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
  2023-09-30  9:03     ` Dominique Martinet
@ 2023-10-03 13:55       ` Wedson Almeida Filho
  2023-10-03 21:57         ` Dominique Martinet
  0 siblings, 1 reply; 62+ messages in thread
From: Wedson Almeida Filho @ 2023-10-03 13:55 UTC (permalink / raw)
  To: Dominique Martinet
  Cc: Eric Van Hensbergen, Christian Schoenebeck, Alexander Viro,
	Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Latchesar Ionkov, v9fs

On Sat, 30 Sept 2023 at 06:03, Dominique Martinet
<asmadeus@codewreck.org> wrote:
>
> Christian Schoenebeck wrote on Sat, Sep 30, 2023 at 10:12:25AM +0200:
> > On Saturday, September 30, 2023 7:00:07 AM CEST Wedson Almeida Filho wrote:
> > > From: Wedson Almeida Filho <walmeida@microsoft.com>
> > >
> > > 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.
> > >
> > > Cc: Eric Van Hensbergen <ericvh@kernel.org>
> > > Cc: Latchesar Ionkov <lucho@ionkov.net>
> > > Cc: Dominique Martinet <asmadeus@codewreck.org>
> > > Cc: Christian Schoenebeck <linux_oss@crudebyte.com>
> > > Cc: v9fs@lists.linux.dev
> > > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> >
> > Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>

Thanks for the review, Christian!

> 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)

There is a cover letter
(https://lore.kernel.org/all/20230930050033.41174-1-wedsonaf@gmail.com/),
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.

>
> --
> Dominique

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

* Re: [PATCH 06/29] ceph: move ceph_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 06/29] ceph: move ceph_xattr_handlers " Wedson Almeida Filho
@ 2023-10-03 14:30   ` Ilya Dryomov
  0 siblings, 0 replies; 62+ messages in thread
From: Ilya Dryomov @ 2023-10-03 14:30 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Xiubo Li, Jeff Layton, ceph-devel

On Sat, Sep 30, 2023 at 7:01 AM Wedson Almeida Filho <wedsonaf@gmail.com> wrote:
>
> From: Wedson Almeida Filho <walmeida@microsoft.com>
>
> This makes it harder for accidental or malicious changes to
> ceph_xattr_handlers at runtime.
>
> Cc: Xiubo Li <xiubli@redhat.com>
> Cc: Ilya Dryomov <idryomov@gmail.com>
> Cc: Jeff Layton <jlayton@kernel.org>
> Cc: ceph-devel@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>  fs/ceph/super.h | 2 +-
>  fs/ceph/xattr.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index 3bfddf34d488..b40be1a0f778 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -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
> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> index 806183959c47..0350d7465bbb 100644
> --- a/fs/ceph/xattr.c
> +++ b/fs/ceph/xattr.c
> @@ -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,
>  };
> --
> 2.34.1
>

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya

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

* Re: [PATCH 16/29] jfs: move jfs_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 16/29] jfs: move jfs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-03 14:54   ` Dave Kleikamp
  0 siblings, 0 replies; 62+ messages in thread
From: Dave Kleikamp @ 2023-10-03 14:54 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, jfs-discussion

On 9/30/23 12:00AM, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> jfs_xattr_handlers at runtime.
> 
> Cc: Dave Kleikamp <shaggy@kernel.org>
> Cc: jfs-discussion@lists.sourceforge.net
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>

> ---
>   fs/jfs/jfs_xattr.h | 2 +-
>   fs/jfs/xattr.c     | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h
> index 0d33816d251d..ec67d8554d2c 100644
> --- a/fs/jfs/jfs_xattr.h
> +++ b/fs/jfs/jfs_xattr.h
> @@ -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 *,
> diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
> index 931e50018f88..001c900a2b4d 100644
> --- a/fs/jfs/xattr.c
> +++ b/fs/jfs/xattr.c
> @@ -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,

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

* Re: [PATCH 27/29] overlayfs: move xattr tables to .rodata
  2023-09-30  5:00 ` [PATCH 27/29] overlayfs: move xattr tables " Wedson Almeida Filho
@ 2023-10-03 16:41   ` Amir Goldstein
  0 siblings, 0 replies; 62+ messages in thread
From: Amir Goldstein @ 2023-10-03 16:41 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Miklos Szeredi, linux-unionfs

On Sat, Sep 30, 2023 at 8:02 AM Wedson Almeida Filho <wedsonaf@gmail.com> wrote:
>
> From: Wedson Almeida Filho <walmeida@microsoft.com>
>
> This makes it harder for accidental or malicious changes to
> ovl_trusted_xattr_handlers or ovl_user_xattr_handlers at runtime.
>
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> Cc: Amir Goldstein <amir73il@gmail.com>
> Cc: linux-unionfs@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Acked-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  fs/overlayfs/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index cc8977498c48..fe7af47be621 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -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
>

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

* Re: [PATCH 03/29] 9p: move xattr-related structs to .rodata
  2023-10-03 13:55       ` Wedson Almeida Filho
@ 2023-10-03 21:57         ` Dominique Martinet
  0 siblings, 0 replies; 62+ messages in thread
From: Dominique Martinet @ 2023-10-03 21:57 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Eric Van Hensbergen, Christian Schoenebeck, Alexander Viro,
	Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Latchesar Ionkov, v9fs

Wedson Almeida Filho wrote on Tue, Oct 03, 2023 at 10:55:44AM -0300:
> > 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)
> 
> There is a cover letter
> (https://lore.kernel.org/all/20230930050033.41174-1-wedsonaf@gmail.com/),
> 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.

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:
Acked-by: Dominique Martinet <asmadeus@codewreck.org>

-- 
Dominique Martinet | Asmadeus

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

* Re: [PATCH 29/29] net: move sockfs_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 29/29] net: move sockfs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-04 21:24   ` Jakub Kicinski
  0 siblings, 0 replies; 62+ messages in thread
From: Jakub Kicinski @ 2023-10-04 21:24 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, David S. Miller, Eric Dumazet, Paolo Abeni,
	Richard Cochran, netdev

On Sat, 30 Sep 2023 02:00:33 -0300 Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> sockfs_xattr_handlers at runtime.

Acked-by: Jakub Kicinski <kuba@kernel.org>

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

* Re: [PATCH 17/29] kernfs: move kernfs_xattr_handlers to .rodata
  2023-09-30  5:00 ` [PATCH 17/29] kernfs: move kernfs_xattr_handlers " Wedson Almeida Filho
@ 2023-10-05 10:37   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 62+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-05 10:37 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Tejun Heo

On Sat, Sep 30, 2023 at 02:00:21AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> kernfs_xattr_handlers at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Tejun Heo <tj@kernel.org>
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>


Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH 25/29] ubifs: move ubifs_xattr_handlers to .rodata
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-10-07  1:39     ` Zhihao Cheng
  -1 siblings, 0 replies; 62+ messages in thread
From: Zhihao Cheng @ 2023-10-07  1:39 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Richard Weinberger, linux-mtd

在 2023/9/30 13:00, Wedson Almeida Filho 写道:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> ubifs_xattr_handlers at runtime.
> 
> Cc: Richard Weinberger <richard@nod.at>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>   fs/ubifs/ubifs.h | 2 +-
>   fs/ubifs/xattr.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> 
> diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
> index 4c36044140e7..8a9a66255e7e 100644
> --- a/fs/ubifs/ubifs.h
> +++ b/fs/ubifs/ubifs.h
> @@ -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);
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 349228dd1191..5e17e9591e6e 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -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
> 


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

* Re: [PATCH 25/29] ubifs: move ubifs_xattr_handlers to .rodata
@ 2023-10-07  1:39     ` Zhihao Cheng
  0 siblings, 0 replies; 62+ messages in thread
From: Zhihao Cheng @ 2023-10-07  1:39 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Richard Weinberger, linux-mtd

在 2023/9/30 13:00, Wedson Almeida Filho 写道:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> ubifs_xattr_handlers at runtime.
> 
> Cc: Richard Weinberger <richard@nod.at>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>   fs/ubifs/ubifs.h | 2 +-
>   fs/ubifs/xattr.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> 
> diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
> index 4c36044140e7..8a9a66255e7e 100644
> --- a/fs/ubifs/ubifs.h
> +++ b/fs/ubifs/ubifs.h
> @@ -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);
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 349228dd1191..5e17e9591e6e 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -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
> 


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-10-07  1:39     ` Zhihao Cheng
  -1 siblings, 0 replies; 62+ messages in thread
From: Zhihao Cheng @ 2023-10-07  1:39 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, David Woodhouse,
	Richard Weinberger, linux-mtd

在 2023/9/30 13:00, Wedson Almeida Filho 写道:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> jffs2_xattr_handlers at runtime.
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>   fs/jffs2/xattr.c | 2 +-
>   fs/jffs2/xattr.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
> index 3b6bdc9a49e1..00224f3a8d6e 100644
> --- a/fs/jffs2/xattr.c
> +++ b/fs/jffs2/xattr.c
> @@ -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,
> diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
> index 1b5030a3349d..7e7de093ec0a 100644
> --- a/fs/jffs2/xattr.h
> +++ b/fs/jffs2/xattr.h
> @@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
>   extern 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;
>   
> 


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

* Re: [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata
@ 2023-10-07  1:39     ` Zhihao Cheng
  0 siblings, 0 replies; 62+ messages in thread
From: Zhihao Cheng @ 2023-10-07  1:39 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, David Woodhouse,
	Richard Weinberger, linux-mtd

在 2023/9/30 13:00, Wedson Almeida Filho 写道:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> jffs2_xattr_handlers at runtime.
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> ---
>   fs/jffs2/xattr.c | 2 +-
>   fs/jffs2/xattr.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
> index 3b6bdc9a49e1..00224f3a8d6e 100644
> --- a/fs/jffs2/xattr.c
> +++ b/fs/jffs2/xattr.c
> @@ -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,
> diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
> index 1b5030a3349d..7e7de093ec0a 100644
> --- a/fs/jffs2/xattr.h
> +++ b/fs/jffs2/xattr.h
> @@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
>   extern 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;
>   
> 


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-10-07  5:50     ` Gao Xiang
  -1 siblings, 0 replies; 62+ messages in thread
From: Gao Xiang @ 2023-10-07  5:50 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, linux-erofs



On 2023/9/30 13:00, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> erofs_xattr_handlers or xattr_handler_map at runtime.
> 
> Cc: Gao Xiang <xiang@kernel.org>
> Cc: Chao Yu <chao@kernel.org>
> Cc: Yue Hu <huyue2@coolpad.com>
> Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
> Cc: linux-erofs@lists.ozlabs.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Acked-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

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

* Re: [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
@ 2023-10-07  5:50     ` Gao Xiang
  0 siblings, 0 replies; 62+ messages in thread
From: Gao Xiang @ 2023-10-07  5:50 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Yue Hu, linux-erofs, Wedson Almeida Filho



On 2023/9/30 13:00, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> erofs_xattr_handlers or xattr_handler_map at runtime.
> 
> Cc: Gao Xiang <xiang@kernel.org>
> Cc: Chao Yu <chao@kernel.org>
> Cc: Yue Hu <huyue2@coolpad.com>
> Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
> Cc: linux-erofs@lists.ozlabs.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Acked-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

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

* Re: [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
  2023-09-30  5:00   ` Wedson Almeida Filho
@ 2023-10-07  6:37     ` Chao Yu
  -1 siblings, 0 replies; 62+ messages in thread
From: Chao Yu @ 2023-10-07  6:37 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Jaegeuk Kim, linux-f2fs-devel

On 2023/9/30 13:00, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> f2fs_xattr_handlers or f2fs_xattr_handler_map at runtime.
> 
> Cc: Jaegeuk Kim <jaegeuk@kernel.org>
> Cc: Chao Yu <chao@kernel.org>
> Cc: linux-f2fs-devel@lists.sourceforge.net
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

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

* Re: [f2fs-dev] [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
@ 2023-10-07  6:37     ` Chao Yu
  0 siblings, 0 replies; 62+ messages in thread
From: Chao Yu @ 2023-10-07  6:37 UTC (permalink / raw)
  To: Wedson Almeida Filho, Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: Jaegeuk Kim, linux-f2fs-devel, linux-kernel, Wedson Almeida Filho

On 2023/9/30 13:00, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> f2fs_xattr_handlers or f2fs_xattr_handler_map at runtime.
> 
> Cc: Jaegeuk Kim <jaegeuk@kernel.org>
> Cc: Chao Yu <chao@kernel.org>
> Cc: linux-f2fs-devel@lists.sourceforge.net
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH 00/29] const xattr tables
  2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
                   ` (29 preceding siblings ...)
  2023-10-03 13:28 ` [PATCH 00/29] const xattr tables Christian Brauner
@ 2023-10-09 14:43 ` Christian Brauner
  30 siblings, 0 replies; 62+ messages in thread
From: Christian Brauner @ 2023-10-09 14:43 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Christian Brauner, Alexander Viro, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho

On Sat, Sep 30, 2023 at 02:00:04AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
>
> 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.

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

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

end of thread, other threads:[~2023-10-09 14:44 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-30  5:00 [PATCH 00/29] const xattr tables Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 01/29] xattr: make the xattr array itself const Wedson Almeida Filho
2023-09-30  6:54   ` kernel test robot
2023-10-02  9:58   ` Thomas Weißschuh
2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 03/29] 9p: move xattr-related structs " Wedson Almeida Filho
2023-09-30  8:12   ` Christian Schoenebeck
2023-09-30  9:03     ` Dominique Martinet
2023-10-03 13:55       ` Wedson Almeida Filho
2023-10-03 21:57         ` Dominique Martinet
2023-09-30  5:00 ` [PATCH 04/29] afs: move afs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 05/29] btrfs: move btrfs_xattr_handlers " Wedson Almeida Filho
2023-10-02 11:28   ` David Sterba
2023-10-02 11:37     ` David Sterba
2023-10-03 13:48       ` Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 06/29] ceph: move ceph_xattr_handlers " Wedson Almeida Filho
2023-10-03 14:30   ` Ilya Dryomov
2023-09-30  5:00 ` [PATCH 07/29] ecryptfs: move ecryptfs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map " Wedson Almeida Filho
2023-09-30  5:00   ` Wedson Almeida Filho
2023-10-07  5:50   ` Gao Xiang
2023-10-07  5:50     ` Gao Xiang
2023-09-30  5:00 ` [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map " Wedson Almeida Filho
2023-10-02  9:49   ` Jan Kara
2023-09-30  5:00 ` [f2fs-dev] [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map " Wedson Almeida Filho
2023-09-30  5:00   ` Wedson Almeida Filho
2023-10-07  6:37   ` Chao Yu
2023-10-07  6:37     ` [f2fs-dev] " Chao Yu
2023-09-30  5:00 ` [PATCH 11/29] fuse: move fuse_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 12/29] gfs2: move gfs2_xattr_handlers_max " Wedson Almeida Filho
2023-09-30  5:00   ` [Cluster-devel] " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 13/29] hfs: move hfs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 14/29] hfsplus: move hfsplus_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 15/29] jffs2: move jffs2_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00   ` Wedson Almeida Filho
2023-10-07  1:39   ` Zhihao Cheng
2023-10-07  1:39     ` Zhihao Cheng
2023-09-30  5:00 ` [PATCH 16/29] jfs: move jfs_xattr_handlers " Wedson Almeida Filho
2023-10-03 14:54   ` Dave Kleikamp
2023-09-30  5:00 ` [PATCH 17/29] kernfs: move kernfs_xattr_handlers " Wedson Almeida Filho
2023-10-05 10:37   ` Greg Kroah-Hartman
2023-09-30  5:00 ` [PATCH 18/29] nfs: move nfs4_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 19/29] ntfs3: move ntfs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 21/29] orangefs: move orangefs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 22/29] reiserfs: move reiserfs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 23/29] smb: move cifs_xattr_handlers " Wedson Almeida Filho
2023-10-01 19:59   ` Steve French
2023-09-30  5:00 ` [PATCH 24/29] squashfs: move squashfs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 25/29] ubifs: move ubifs_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00   ` Wedson Almeida Filho
2023-10-07  1:39   ` Zhihao Cheng
2023-10-07  1:39     ` Zhihao Cheng
2023-09-30  5:00 ` [PATCH 26/29] xfs: move xfs_xattr_handlers " Wedson Almeida Filho
2023-10-01 16:18   ` Darrick J. Wong
2023-09-30  5:00 ` [PATCH 27/29] overlayfs: move xattr tables " Wedson Almeida Filho
2023-10-03 16:41   ` Amir Goldstein
2023-09-30  5:00 ` [PATCH 28/29] shmem: move shmem_xattr_handlers " Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 29/29] net: move sockfs_xattr_handlers " Wedson Almeida Filho
2023-10-04 21:24   ` Jakub Kicinski
2023-10-03 13:28 ` [PATCH 00/29] const xattr tables Christian Brauner
2023-10-09 14:43 ` Christian Brauner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.