xfs: move xfs_xattr_handlers to .rodata
authorWedson Almeida Filho <walmeida@microsoft.com>
Sat, 30 Sep 2023 05:00:30 +0000 (02:00 -0300)
committerChristian Brauner <brauner@kernel.org>
Tue, 10 Oct 2023 11:49:20 +0000 (13:49 +0200)
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>
Link: https://lore.kernel.org/r/20230930050033.41174-27-wedsonaf@gmail.com
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/xfs/xfs_xattr.c
fs/xfs/xfs_xattr.h

index 43e5c219aaed568ffb5a711b4583b2cdf1723d9c..77418bcd6f3a99930e78c7e436e8b3a0ec51154a 100644 (file)
@@ -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,
index 2b09133b1b9b291a78b1d35b59d5ea4a1287e9f3..cec766cad26cd89a6b3a2527e6eda0fa058588d1 100644 (file)
@@ -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__ */