Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfs: move nfs4_xattr_handlers to .rodata

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>

authored by

Wedson Almeida Filho and committed by
Christian Brauner
f496647e ffb2e065

+3 -3
+1 -1
fs/nfs/nfs.h
··· 18 18 const struct rpc_version *rpc_vers; /* NFS version information */ 19 19 const struct nfs_rpc_ops *rpc_ops; /* NFS operations */ 20 20 const struct super_operations *sops; /* NFS Super operations */ 21 - const struct xattr_handler **xattr; /* NFS xattr handlers */ 21 + const struct xattr_handler * const *xattr; /* NFS xattr handlers */ 22 22 struct list_head list; /* List of NFS versions */ 23 23 }; 24 24
+1 -1
fs/nfs/nfs4_fs.h
··· 315 315 struct nfs_fh *, 316 316 struct nfs_fattr *); 317 317 extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); 318 - extern const struct xattr_handler *nfs4_xattr_handlers[]; 318 + extern const struct xattr_handler * const nfs4_xattr_handlers[]; 319 319 extern int nfs4_set_rw_stateid(nfs4_stateid *stateid, 320 320 const struct nfs_open_context *ctx, 321 321 const struct nfs_lock_context *l_ctx,
+1 -1
fs/nfs/nfs4proc.c
··· 10733 10733 }; 10734 10734 #endif 10735 10735 10736 - const struct xattr_handler *nfs4_xattr_handlers[] = { 10736 + const struct xattr_handler * const nfs4_xattr_handlers[] = { 10737 10737 &nfs4_xattr_nfs4_acl_handler, 10738 10738 #if defined(CONFIG_NFS_V4_1) 10739 10739 &nfs4_xattr_nfs4_dacl_handler,