[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <uxsmzymguamc7bvhtgn2w7z43kxrpq5nuf74m2n6avvsk3efes@g47qjljxanqs>
Date: Tue, 25 Nov 2025 13:00:06 +0100
From: Jan Kara <jack@...e.cz>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Kees Cook <kees@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>, NeilBrown <neil@...wn.name>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH RESEND] fs/xattr: Annotate struct simple_xattr with
__counted_by
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@...ux.dev>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.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@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists