From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Thorsten Blum <thorsten.blum@toblux.com>,
tytso@mit.edu, adilger.kernel@dilger.ca, kees@kernel.org,
gustavoars@kernel.org
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] ext4: Annotate struct ext4_xattr_inode_array with __counted_by()
Date: Mon, 29 Jul 2024 08:09:40 -0600 [thread overview]
Message-ID: <db367563-e144-4a2f-8d67-d1b4e879397e@embeddedor.com> (raw)
In-Reply-To: <20240729110454.346918-3-thorsten.blum@toblux.com>
On 29/07/24 05:04, Thorsten Blum wrote:
> Add the __counted_by compiler attribute to the flexible array member
> inodes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
This change seems to be incomplete. The relationship between `count` and
accesses to `inodes` should be adjusted at least in `ext4_expand_inode_array()`
See this for more details:
https://embeddedor.com/blog/2024/06/18/how-to-use-the-new-counted_by-attribute-in-c-and-linux/
Thanks
--
Gustavo
>
> Remove the now obsolete comment on the count field.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
> fs/ext4/xattr.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
> index bd97c4aa8177..e14fb19dc912 100644
> --- a/fs/ext4/xattr.h
> +++ b/fs/ext4/xattr.h
> @@ -130,8 +130,8 @@ struct ext4_xattr_ibody_find {
> };
>
> struct ext4_xattr_inode_array {
> - unsigned int count; /* # of used items in the array */
> - struct inode *inodes[];
> + unsigned int count;
> + struct inode *inodes[] __counted_by(count);
> };
>
> extern const struct xattr_handler ext4_xattr_user_handler;
next prev parent reply other threads:[~2024-07-29 14:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 11:04 [PATCH] ext4: Annotate struct ext4_xattr_inode_array with __counted_by() Thorsten Blum
2024-07-29 14:09 ` Gustavo A. R. Silva [this message]
2024-07-30 17:10 ` Thorsten Blum
2024-07-30 1:21 ` yebin (H)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db367563-e144-4a2f-8d67-d1b4e879397e@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=adilger.kernel@dilger.ca \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thorsten.blum@toblux.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.