* [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with __counted_by
@ 2025-11-22 12:00 Thorsten Blum
2025-11-25 12:00 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-11-22 12:00 UTC (permalink / raw)
To: Kees Cook, Gustavo A. R. Silva, Christian Brauner, Jan Kara,
Jeff Layton, NeilBrown
Cc: Thorsten Blum, linux-kernel, linux-hardening
Add the __counted_by() compiler attribute to the flexible array member
'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
include/linux/xattr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 64e9afe7d647..296b5ee5c979 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -114,7 +114,7 @@ struct simple_xattr {
struct rb_node rb_node;
char *name;
size_t size;
- char value[];
+ char value[] __counted_by(size);
};
void simple_xattrs_init(struct simple_xattrs *xattrs);
--
2.51.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with __counted_by
2025-11-22 12:00 Thorsten Blum
@ 2025-11-25 12:00 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2025-11-25 12:00 UTC (permalink / raw)
To: Thorsten Blum
Cc: Kees Cook, Gustavo A. R. Silva, Christian Brauner, Jan Kara,
Jeff Layton, NeilBrown, linux-kernel, linux-hardening
On Sat 22-11-25 13:00:22, Thorsten Blum wrote:
> Add the __counted_by() compiler attribute to the flexible array member
> 'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> include/linux/xattr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/xattr.h b/include/linux/xattr.h
> index 64e9afe7d647..296b5ee5c979 100644
> --- a/include/linux/xattr.h
> +++ b/include/linux/xattr.h
> @@ -114,7 +114,7 @@ struct simple_xattr {
> struct rb_node rb_node;
> char *name;
> size_t size;
> - char value[];
> + char value[] __counted_by(size);
> };
>
> void simple_xattrs_init(struct simple_xattrs *xattrs);
> --
> 2.51.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with __counted_by
@ 2026-01-05 12:20 Thorsten Blum
2026-01-12 22:30 ` Kees Cook
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2026-01-05 12:20 UTC (permalink / raw)
To: Kees Cook, Gustavo A. R. Silva, Jeff Layton, Jan Kara,
Christian Brauner, NeilBrown
Cc: Thorsten Blum, linux-kernel, linux-hardening
Add the __counted_by() compiler attribute to the flexible array member
'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
include/linux/xattr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 64e9afe7d647..296b5ee5c979 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -114,7 +114,7 @@ struct simple_xattr {
struct rb_node rb_node;
char *name;
size_t size;
- char value[];
+ char value[] __counted_by(size);
};
void simple_xattrs_init(struct simple_xattrs *xattrs);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with __counted_by
2026-01-05 12:20 [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with __counted_by Thorsten Blum
@ 2026-01-12 22:30 ` Kees Cook
0 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2026-01-12 22:30 UTC (permalink / raw)
To: Gustavo A. R. Silva, Jeff Layton, Jan Kara, Christian Brauner,
NeilBrown, Thorsten Blum
Cc: Kees Cook, linux-kernel, linux-hardening
On Mon, 05 Jan 2026 13:20:53 +0100, Thorsten Blum wrote:
> Add the __counted_by() compiler attribute to the flexible array member
> 'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
>
Applied to for-next/hardening, thanks!
[1/1] fs/xattr: Annotate struct simple_xattr with __counted_by
https://git.kernel.org/kees/c/f2c5457dadec
Take care,
--
Kees Cook
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-12 22:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 12:20 [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with __counted_by Thorsten Blum
2026-01-12 22:30 ` Kees Cook
-- strict thread matches above, loose matches on Subject: below --
2025-11-22 12:00 Thorsten Blum
2025-11-25 12:00 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox