[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230930050033.41174-9-wedsonaf@gmail.com>
Date: Sat, 30 Sep 2023 02:00:12 -0300
From: Wedson Almeida Filho <wedsonaf@...il.com>
To: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
linux-fsdevel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Wedson Almeida Filho <walmeida@...rosoft.com>,
Gao Xiang <xiang@...nel.org>, Chao Yu <chao@...nel.org>,
Yue Hu <huyue2@...lpad.com>,
Jeffle Xu <jefflexu@...ux.alibaba.com>,
linux-erofs@...ts.ozlabs.org
Subject: [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
From: Wedson Almeida Filho <walmeida@...rosoft.com>
This makes it harder for accidental or malicious changes to
erofs_xattr_handlers or xattr_handler_map at runtime.
Cc: Gao Xiang <xiang@...nel.org>
Cc: Chao Yu <chao@...nel.org>
Cc: Yue Hu <huyue2@...lpad.com>
Cc: Jeffle Xu <jefflexu@...ux.alibaba.com>
Cc: linux-erofs@...ts.ozlabs.org
Signed-off-by: Wedson Almeida Filho <walmeida@...rosoft.com>
---
fs/erofs/xattr.c | 2 +-
fs/erofs/xattr.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index 40178b6e0688..a6dd68ea5df2 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -166,7 +166,7 @@ const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
};
#endif
-const struct xattr_handler *erofs_xattr_handlers[] = {
+const struct xattr_handler * const erofs_xattr_handlers[] = {
&erofs_xattr_user_handler,
&erofs_xattr_trusted_handler,
#ifdef CONFIG_EROFS_FS_SECURITY
diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h
index f16283cb8c93..b246cd0e135e 100644
--- a/fs/erofs/xattr.h
+++ b/fs/erofs/xattr.h
@@ -23,7 +23,7 @@ static inline const char *erofs_xattr_prefix(unsigned int idx,
{
const struct xattr_handler *handler = NULL;
- static const struct xattr_handler *xattr_handler_map[] = {
+ static const struct xattr_handler * const xattr_handler_map[] = {
[EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler,
#ifdef CONFIG_EROFS_FS_POSIX_ACL
[EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access,
@@ -44,7 +44,7 @@ static inline const char *erofs_xattr_prefix(unsigned int idx,
return xattr_prefix(handler);
}
-extern const struct xattr_handler *erofs_xattr_handlers[];
+extern const struct xattr_handler * const erofs_xattr_handlers[];
int erofs_xattr_prefixes_init(struct super_block *sb);
void erofs_xattr_prefixes_cleanup(struct super_block *sb);
--
2.34.1
Powered by blists - more mailing lists