* [PATCH] keys: Annotate struct asymmetric_key_id with __counted_by
@ 2025-10-23 17:48 Thorsten Blum
2025-10-26 9:02 ` Lukas Wunner
2025-10-27 19:57 ` Jarkko Sakkinen
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-10-23 17:48 UTC (permalink / raw)
To: David Howells, Lukas Wunner, Ignat Korchagin, Jarkko Sakkinen,
Kees Cook, Gustavo A. R. Silva
Cc: Thorsten Blum, keyrings, linux-crypto, 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>
---
include/keys/asymmetric-type.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h
index 69a13e1e5b2e..1b91c8f98688 100644
--- a/include/keys/asymmetric-type.h
+++ b/include/keys/asymmetric-type.h
@@ -49,7 +49,7 @@ enum asymmetric_payload_bits {
*/
struct asymmetric_key_id {
unsigned short len;
- unsigned char data[];
+ unsigned char data[] __counted_by(len);
};
struct asymmetric_key_ids {
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] keys: Annotate struct asymmetric_key_id with __counted_by
2025-10-23 17:48 [PATCH] keys: Annotate struct asymmetric_key_id with __counted_by Thorsten Blum
@ 2025-10-26 9:02 ` Lukas Wunner
2025-10-27 19:57 ` Jarkko Sakkinen
1 sibling, 0 replies; 3+ messages in thread
From: Lukas Wunner @ 2025-10-26 9:02 UTC (permalink / raw)
To: Thorsten Blum
Cc: David Howells, Ignat Korchagin, Jarkko Sakkinen, Kees Cook,
Gustavo A. R. Silva, keyrings, linux-crypto, linux-kernel,
linux-hardening
On Thu, Oct 23, 2025 at 07:48:11PM +0200, 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>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] keys: Annotate struct asymmetric_key_id with __counted_by
2025-10-23 17:48 [PATCH] keys: Annotate struct asymmetric_key_id with __counted_by Thorsten Blum
2025-10-26 9:02 ` Lukas Wunner
@ 2025-10-27 19:57 ` Jarkko Sakkinen
1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2025-10-27 19:57 UTC (permalink / raw)
To: Thorsten Blum
Cc: David Howells, Lukas Wunner, Ignat Korchagin, Kees Cook,
Gustavo A. R. Silva, keyrings, linux-crypto, linux-kernel,
linux-hardening
On Thu, Oct 23, 2025 at 07:48:11PM +0200, 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>
> ---
> include/keys/asymmetric-type.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h
> index 69a13e1e5b2e..1b91c8f98688 100644
> --- a/include/keys/asymmetric-type.h
> +++ b/include/keys/asymmetric-type.h
> @@ -49,7 +49,7 @@ enum asymmetric_payload_bits {
> */
> struct asymmetric_key_id {
> unsigned short len;
> - unsigned char data[];
> + unsigned char data[] __counted_by(len);
> };
>
> struct asymmetric_key_ids {
> --
> 2.51.0
>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-27 19:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 17:48 [PATCH] keys: Annotate struct asymmetric_key_id with __counted_by Thorsten Blum
2025-10-26 9:02 ` Lukas Wunner
2025-10-27 19:57 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).