* [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
[not found] <20230930050033.41174-1-wedsonaf@gmail.com>
@ 2023-09-30 5:00 ` Wedson Almeida Filho
2023-10-02 11:28 ` David Sterba
0 siblings, 1 reply; 4+ 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, Chris Mason, Josef Bacik,
David Sterba, linux-btrfs
From: Wedson Almeida Filho <walmeida@microsoft.com>
This makes it harder for accidental or malicious changes to
btrfs_xattr_handlers at runtime.
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
---
fs/btrfs/xattr.c | 2 +-
fs/btrfs/xattr.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index fc4b20c2688a..d82d9545386a 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -442,7 +442,7 @@ static const struct xattr_handler btrfs_btrfs_xattr_handler = {
.set = btrfs_xattr_handler_set_prop,
};
-const struct xattr_handler *btrfs_xattr_handlers[] = {
+const struct xattr_handler * const btrfs_xattr_handlers[] = {
&btrfs_security_xattr_handler,
&btrfs_trusted_xattr_handler,
&btrfs_user_xattr_handler,
diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h
index 1cd3fc0a8f17..118118ca3e1d 100644
--- a/fs/btrfs/xattr.h
+++ b/fs/btrfs/xattr.h
@@ -8,7 +8,7 @@
#include <linux/xattr.h>
-extern const struct xattr_handler *btrfs_xattr_handlers[];
+extern const struct xattr_handler * const btrfs_xattr_handlers[];
int btrfs_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
2023-09-30 5:00 ` [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata Wedson Almeida Filho
@ 2023-10-02 11:28 ` David Sterba
2023-10-02 11:37 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2023-10-02 11:28 UTC (permalink / raw)
To: Wedson Almeida Filho
Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
Wedson Almeida Filho, Chris Mason, Josef Bacik, David Sterba,
linux-btrfs
On Sat, Sep 30, 2023 at 02:00:09AM -0300, Wedson Almeida Filho wrote:
> From: Wedson Almeida Filho <walmeida@microsoft.com>
>
> This makes it harder for accidental or malicious changes to
> btrfs_xattr_handlers at runtime.
>
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <josef@toxicpanda.com>
> Cc: David Sterba <dsterba@suse.com>
> Cc: linux-btrfs@vger.kernel.org
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
With slightly updated changelog added to misc-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
2023-10-02 11:28 ` David Sterba
@ 2023-10-02 11:37 ` David Sterba
2023-10-03 13:48 ` Wedson Almeida Filho
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2023-10-02 11:37 UTC (permalink / raw)
To: David Sterba
Cc: Wedson Almeida Filho, Alexander Viro, Christian Brauner,
linux-fsdevel, linux-kernel, Wedson Almeida Filho, Chris Mason,
Josef Bacik, David Sterba, linux-btrfs
On Mon, Oct 02, 2023 at 01:28:58PM +0200, David Sterba wrote:
> On Sat, Sep 30, 2023 at 02:00:09AM -0300, Wedson Almeida Filho wrote:
> > From: Wedson Almeida Filho <walmeida@microsoft.com>
> >
> > This makes it harder for accidental or malicious changes to
> > btrfs_xattr_handlers at runtime.
> >
> > Cc: Chris Mason <clm@fb.com>
> > Cc: Josef Bacik <josef@toxicpanda.com>
> > Cc: David Sterba <dsterba@suse.com>
> > Cc: linux-btrfs@vger.kernel.org
> > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
>
> With slightly updated changelog added to misc-next, thanks.
Removed again. I did not notice first that this is part of a larger
series, please also CC the [PATCH 0/N] patch.
There's a warning:
fs/btrfs/super.c: In function ‘btrfs_fill_super’:
fs/btrfs/super.c:1107:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1107 | sb->s_xattr = btrfs_xattr_handlers;
| ^
but the patch changing the type is present in the series.
Please update the changelog of btrfs patch with:
Add const specifier also to the pointed array members of
btrfs_xattr_handlers. This moves the whole structure to the .rodata
section which makes it harder for accidental or malicious changes to
btrfs_xattr_handlers at runtime.
or use it for others patches too.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata
2023-10-02 11:37 ` David Sterba
@ 2023-10-03 13:48 ` Wedson Almeida Filho
0 siblings, 0 replies; 4+ messages in thread
From: Wedson Almeida Filho @ 2023-10-03 13:48 UTC (permalink / raw)
To: dsterba
Cc: Alexander Viro, Christian Brauner, linux-fsdevel, linux-kernel,
Wedson Almeida Filho, Chris Mason, Josef Bacik, David Sterba,
linux-btrfs
On Mon, 2 Oct 2023 at 08:44, David Sterba <dsterba@suse.cz> wrote:
>
> On Mon, Oct 02, 2023 at 01:28:58PM +0200, David Sterba wrote:
> > On Sat, Sep 30, 2023 at 02:00:09AM -0300, Wedson Almeida Filho wrote:
> > > From: Wedson Almeida Filho <walmeida@microsoft.com>
> > >
> > > This makes it harder for accidental or malicious changes to
> > > btrfs_xattr_handlers at runtime.
> > >
> > > Cc: Chris Mason <clm@fb.com>
> > > Cc: Josef Bacik <josef@toxicpanda.com>
> > > Cc: David Sterba <dsterba@suse.com>
> > > Cc: linux-btrfs@vger.kernel.org
> > > Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
> >
> > With slightly updated changelog added to misc-next, thanks.
>
> Removed again. I did not notice first that this is part of a larger
> series, please also CC the [PATCH 0/N] patch.
Sorry for the confusion, I will CC you there too.
> There's a warning:
>
> fs/btrfs/super.c: In function ‘btrfs_fill_super’:
> fs/btrfs/super.c:1107:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
> 1107 | sb->s_xattr = btrfs_xattr_handlers;
> | ^
>
> but the patch changing the type is present in the series.
>
> Please update the changelog of btrfs patch with:
>
> Add const specifier also to the pointed array members of
> btrfs_xattr_handlers. This moves the whole structure to the .rodata
> section which makes it harder for accidental or malicious changes to
> btrfs_xattr_handlers at runtime.
Will do. Thanks!
> or use it for others patches too.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-03 13:48 UTC | newest]
Thread overview: 4+ 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 05/29] btrfs: move btrfs_xattr_handlers to .rodata Wedson Almeida Filho
2023-10-02 11:28 ` David Sterba
2023-10-02 11:37 ` David Sterba
2023-10-03 13:48 ` Wedson Almeida Filho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox