[16/29] jfs: move jfs_xattr_handlers to .rodata

Message ID 20230930050033.41174-17-wedsonaf@gmail.com
State New
Headers
Series const xattr tables |

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
jfs_xattr_handlers at runtime.

Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: jfs-discussion@lists.sourceforge.net
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/jfs/jfs_xattr.h | 2 +-
 fs/jfs/xattr.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Dave Kleikamp Oct. 3, 2023, 2:54 p.m. UTC | #1
On 9/30/23 12:00AM, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> jfs_xattr_handlers at runtime.
> 
> Cc: Dave Kleikamp <shaggy@kernel.org>
> Cc: jfs-discussion@lists.sourceforge.net
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>

> ---
>   fs/jfs/jfs_xattr.h | 2 +-
>   fs/jfs/xattr.c     | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h
> index 0d33816d251d..ec67d8554d2c 100644
> --- a/fs/jfs/jfs_xattr.h
> +++ b/fs/jfs/jfs_xattr.h
> @@ -46,7 +46,7 @@ extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
>   extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
>   extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
>   
> -extern const struct xattr_handler *jfs_xattr_handlers[];
> +extern const struct xattr_handler * const jfs_xattr_handlers[];
>   
>   #ifdef CONFIG_JFS_SECURITY
>   extern int jfs_init_security(tid_t, struct inode *, struct inode *,
> diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
> index 931e50018f88..001c900a2b4d 100644
> --- a/fs/jfs/xattr.c
> +++ b/fs/jfs/xattr.c
> @@ -985,7 +985,7 @@ static const struct xattr_handler jfs_trusted_xattr_handler = {
>   	.set = jfs_xattr_set,
>   };
>   
> -const struct xattr_handler *jfs_xattr_handlers[] = {
> +const struct xattr_handler * const jfs_xattr_handlers[] = {
>   	&jfs_os2_xattr_handler,
>   	&jfs_user_xattr_handler,
>   	&jfs_security_xattr_handler,
  

Patch

diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h
index 0d33816d251d..ec67d8554d2c 100644
--- a/fs/jfs/jfs_xattr.h
+++ b/fs/jfs/jfs_xattr.h
@@ -46,7 +46,7 @@  extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
 extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
 extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
 
-extern const struct xattr_handler *jfs_xattr_handlers[];
+extern const struct xattr_handler * const jfs_xattr_handlers[];
 
 #ifdef CONFIG_JFS_SECURITY
 extern int jfs_init_security(tid_t, struct inode *, struct inode *,
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 931e50018f88..001c900a2b4d 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -985,7 +985,7 @@  static const struct xattr_handler jfs_trusted_xattr_handler = {
 	.set = jfs_xattr_set,
 };
 
-const struct xattr_handler *jfs_xattr_handlers[] = {
+const struct xattr_handler * const jfs_xattr_handlers[] = {
 	&jfs_os2_xattr_handler,
 	&jfs_user_xattr_handler,
 	&jfs_security_xattr_handler,