* [PATCH] ecryptfs: Annotate struct ecryptfs_message with __counted_by
@ 2026-01-12 11:53 Thorsten Blum
2026-01-13 1:41 ` Tyler Hicks
2026-01-13 19:53 ` Kees Cook
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-01-12 11:53 UTC (permalink / raw)
To: Tyler Hicks, Kees Cook, Gustavo A. R. Silva, Christian Brauner,
Al Viro, Eric Biggers, Ard Biesheuvel
Cc: Thorsten Blum, ecryptfs, linux-kernel, linux-hardening
Add the __counted_by() compiler attribute to the flexible array member
'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
fs/ecryptfs/ecryptfs_kernel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 62a2ea7f59ed..f58b12be8267 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -359,7 +359,7 @@ struct ecryptfs_message {
/* Inherits from msg_ctx->index */
u32 index;
u32 data_len;
- u8 data[];
+ u8 data[] __counted_by(data_len);
};
struct ecryptfs_msg_ctx {
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ecryptfs: Annotate struct ecryptfs_message with __counted_by
2026-01-12 11:53 [PATCH] ecryptfs: Annotate struct ecryptfs_message with __counted_by Thorsten Blum
@ 2026-01-13 1:41 ` Tyler Hicks
2026-01-13 19:53 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Tyler Hicks @ 2026-01-13 1:41 UTC (permalink / raw)
To: Thorsten Blum
Cc: Kees Cook, Gustavo A. R. Silva, Christian Brauner, Al Viro,
Eric Biggers, Ard Biesheuvel, ecryptfs, linux-kernel,
linux-hardening
On 2026-01-12 12:53:11, Thorsten Blum wrote:
> Add the __counted_by() compiler attribute to the flexible array member
> 'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Nice! I wasn't aware of this attribute. I'm surprised it isn't
documented under Documentation/.
Acked-by: Tyler Hicks <code@tyhicks.com>
Thank you!
Tyler
> ---
> fs/ecryptfs/ecryptfs_kernel.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
> index 62a2ea7f59ed..f58b12be8267 100644
> --- a/fs/ecryptfs/ecryptfs_kernel.h
> +++ b/fs/ecryptfs/ecryptfs_kernel.h
> @@ -359,7 +359,7 @@ struct ecryptfs_message {
> /* Inherits from msg_ctx->index */
> u32 index;
> u32 data_len;
> - u8 data[];
> + u8 data[] __counted_by(data_len);
> };
>
> struct ecryptfs_msg_ctx {
> --
> Thorsten Blum <thorsten.blum@linux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ecryptfs: Annotate struct ecryptfs_message with __counted_by
2026-01-12 11:53 [PATCH] ecryptfs: Annotate struct ecryptfs_message with __counted_by Thorsten Blum
2026-01-13 1:41 ` Tyler Hicks
@ 2026-01-13 19:53 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2026-01-13 19:53 UTC (permalink / raw)
To: Tyler Hicks, Gustavo A. R. Silva, Christian Brauner, Al Viro,
Eric Biggers, Ard Biesheuvel, Thorsten Blum
Cc: Kees Cook, ecryptfs, linux-kernel, linux-hardening
On Mon, 12 Jan 2026 12:53:11 +0100, Thorsten Blum wrote:
> Add the __counted_by() compiler attribute to the flexible array member
> 'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
>
Applied to for-next/hardening, thanks!
[1/1] ecryptfs: Annotate struct ecryptfs_message with __counted_by
https://git.kernel.org/kees/c/574d944d2ff3
Take care,
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-13 19:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 11:53 [PATCH] ecryptfs: Annotate struct ecryptfs_message with __counted_by Thorsten Blum
2026-01-13 1:41 ` Tyler Hicks
2026-01-13 19:53 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox