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

kernfs: move kernfs_xattr_handlers to .rodata

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>
Link: https://lore.kernel.org/r/20230930050033.41174-18-wedsonaf@gmail.com
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Wedson Almeida Filho and committed by
Christian Brauner
ffb2e065 ea780283

+2 -2
+1 -1
fs/kernfs/inode.c
··· 445 445 .set = kernfs_vfs_user_xattr_set, 446 446 }; 447 447 448 - const struct xattr_handler *kernfs_xattr_handlers[] = { 448 + const struct xattr_handler * const kernfs_xattr_handlers[] = { 449 449 &kernfs_trusted_xattr_handler, 450 450 &kernfs_security_xattr_handler, 451 451 &kernfs_user_xattr_handler,
+1 -1
fs/kernfs/kernfs-internal.h
··· 127 127 /* 128 128 * inode.c 129 129 */ 130 - extern const struct xattr_handler *kernfs_xattr_handlers[]; 130 + extern const struct xattr_handler * const kernfs_xattr_handlers[]; 131 131 void kernfs_evict_inode(struct inode *inode); 132 132 int kernfs_iop_permission(struct mnt_idmap *idmap, 133 133 struct inode *inode, int mask);