diff mbox series

[06/29] ceph: move ceph_xattr_handlers to .rodata

Message ID 20230930050033.41174-7-wedsonaf@gmail.com
State New
Headers show
Series None | expand

Commit Message

Wedson Almeida Filho Sept. 30, 2023, 5 a.m. UTC
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(-)

Comments

Ilya Dryomov Oct. 3, 2023, 2:30 p.m. UTC | #1
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
diff mbox series

Patch

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,
 };