linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata
       [not found] <20230930050033.41174-1-wedsonaf@gmail.com>
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-09-30  5:00 ` [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map " Wedson Almeida Filho
  1 sibling, 0 replies; 3+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Theodore Ts'o,
	Andreas Dilger, linux-ext4

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ext4_xattr_handlers at runtime.

Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ext4/xattr.c | 2 +-
 fs/ext4/xattr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 05151d61b00b..5e8a7328fe4e 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -98,7 +98,7 @@ static const struct xattr_handler * const ext4_xattr_handler_map[] = {
 	[EXT4_XATTR_INDEX_HURD]		     = &ext4_xattr_hurd_handler,
 };
 
-const struct xattr_handler *ext4_xattr_handlers[] = {
+const struct xattr_handler * const ext4_xattr_handlers[] = {
 	&ext4_xattr_user_handler,
 	&ext4_xattr_trusted_handler,
 #ifdef CONFIG_EXT4_FS_SECURITY
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 824faf0b15a8..bd97c4aa8177 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -193,7 +193,7 @@ extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
 			    struct ext4_inode *raw_inode, handle_t *handle);
 extern void ext4_evict_ea_inode(struct inode *inode);
 
-extern const struct xattr_handler *ext4_xattr_handlers[];
+extern const struct xattr_handler * const ext4_xattr_handlers[];
 
 extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
 				 struct ext4_xattr_ibody_find *is);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
       [not found] <20230930050033.41174-1-wedsonaf@gmail.com>
  2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
@ 2023-09-30  5:00 ` Wedson Almeida Filho
  2023-10-02  9:49   ` Jan Kara
  1 sibling, 1 reply; 3+ messages in thread
From: Wedson Almeida Filho @ 2023-09-30  5:00 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, linux-fsdevel
  Cc: linux-kernel, Wedson Almeida Filho, Jan Kara, linux-ext4

From: Wedson Almeida Filho <walmeida@microsoft.com>

This makes it harder for accidental or malicious changes to
ext2_xattr_handlers or ext2_xattr_handler_map at runtime.

Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
 fs/ext2/xattr.c | 4 ++--
 fs/ext2/xattr.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 8906ba479aaf..cfbe376da612 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -98,7 +98,7 @@ static struct buffer_head *ext2_xattr_cache_find(struct inode *,
 static void ext2_xattr_rehash(struct ext2_xattr_header *,
 			      struct ext2_xattr_entry *);
 
-static const struct xattr_handler *ext2_xattr_handler_map[] = {
+static const struct xattr_handler * const ext2_xattr_handler_map[] = {
 	[EXT2_XATTR_INDEX_USER]		     = &ext2_xattr_user_handler,
 #ifdef CONFIG_EXT2_FS_POSIX_ACL
 	[EXT2_XATTR_INDEX_POSIX_ACL_ACCESS]  = &nop_posix_acl_access,
@@ -110,7 +110,7 @@ static const struct xattr_handler *ext2_xattr_handler_map[] = {
 #endif
 };
 
-const struct xattr_handler *ext2_xattr_handlers[] = {
+const struct xattr_handler * const ext2_xattr_handlers[] = {
 	&ext2_xattr_user_handler,
 	&ext2_xattr_trusted_handler,
 #ifdef CONFIG_EXT2_FS_SECURITY
diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h
index 7925f596e8e2..6a4966949047 100644
--- a/fs/ext2/xattr.h
+++ b/fs/ext2/xattr.h
@@ -72,7 +72,7 @@ extern void ext2_xattr_delete_inode(struct inode *);
 extern struct mb_cache *ext2_xattr_create_cache(void);
 extern void ext2_xattr_destroy_cache(struct mb_cache *cache);
 
-extern const struct xattr_handler *ext2_xattr_handlers[];
+extern const struct xattr_handler * const ext2_xattr_handlers[];
 
 # else  /* CONFIG_EXT2_FS_XATTR */
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
  2023-09-30  5:00 ` [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map " Wedson Almeida Filho
@ 2023-10-02  9:49   ` Jan Kara
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2023-10-02  9:49 UTC (permalink / raw)
  To: Wedson Almeida Filho
  Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
	Wedson Almeida Filho, Jan Kara, linux-ext4

On Sat 30-09-23 02:00:13, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
> 
> This makes it harder for accidental or malicious changes to
> ext2_xattr_handlers or ext2_xattr_handler_map at runtime.
> 
> Cc: Jan Kara <jack@suse.com>
> Cc: linux-ext4@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Looks good to me. Feel free to add:

Acked-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext2/xattr.c | 4 ++--
>  fs/ext2/xattr.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> index 8906ba479aaf..cfbe376da612 100644
> --- a/fs/ext2/xattr.c
> +++ b/fs/ext2/xattr.c
> @@ -98,7 +98,7 @@ static struct buffer_head *ext2_xattr_cache_find(struct inode *,
>  static void ext2_xattr_rehash(struct ext2_xattr_header *,
>  			      struct ext2_xattr_entry *);
>  
> -static const struct xattr_handler *ext2_xattr_handler_map[] = {
> +static const struct xattr_handler * const ext2_xattr_handler_map[] = {
>  	[EXT2_XATTR_INDEX_USER]		     = &ext2_xattr_user_handler,
>  #ifdef CONFIG_EXT2_FS_POSIX_ACL
>  	[EXT2_XATTR_INDEX_POSIX_ACL_ACCESS]  = &nop_posix_acl_access,
> @@ -110,7 +110,7 @@ static const struct xattr_handler *ext2_xattr_handler_map[] = {
>  #endif
>  };
>  
> -const struct xattr_handler *ext2_xattr_handlers[] = {
> +const struct xattr_handler * const ext2_xattr_handlers[] = {
>  	&ext2_xattr_user_handler,
>  	&ext2_xattr_trusted_handler,
>  #ifdef CONFIG_EXT2_FS_SECURITY
> diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h
> index 7925f596e8e2..6a4966949047 100644
> --- a/fs/ext2/xattr.h
> +++ b/fs/ext2/xattr.h
> @@ -72,7 +72,7 @@ extern void ext2_xattr_delete_inode(struct inode *);
>  extern struct mb_cache *ext2_xattr_create_cache(void);
>  extern void ext2_xattr_destroy_cache(struct mb_cache *cache);
>  
> -extern const struct xattr_handler *ext2_xattr_handlers[];
> +extern const struct xattr_handler * const ext2_xattr_handlers[];
>  
>  # else  /* CONFIG_EXT2_FS_XATTR */
>  
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-02  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230930050033.41174-1-wedsonaf@gmail.com>
2023-09-30  5:00 ` [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Wedson Almeida Filho
2023-09-30  5:00 ` [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map " Wedson Almeida Filho
2023-10-02  9:49   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).