nfs: move nfs4_xattr_handlers to .rodata
authorWedson Almeida Filho <walmeida@microsoft.com>
Sat, 30 Sep 2023 05:00:22 +0000 (02:00 -0300)
committerChristian Brauner <brauner@kernel.org>
Mon, 9 Oct 2023 14:24:20 +0000 (16:24 +0200)
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>
Link: https://lore.kernel.org/r/20230930050033.41174-19-wedsonaf@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/nfs/nfs.h
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c

index 5ba00610aede074400a5c3d02f310099833a797d..0d3ce0460e35b9e0371e3d2f296350e1a4bb121c 100644 (file)
@@ -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 */
 };
 
index 47c5c1f86d662290bbee8261c39e73195952f591..827d00e2f094dc7cf0e959ac75091b8012e324b0 100644 (file)
@@ -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,
index 794343790ea8bbba5493f0374d5297c45f87dd4f..134e169342514c29282244baa428353e7165c600 100644 (file)
@@ -10733,7 +10733,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,