[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHC9VhRwUJkJJVnytxbME4ycmd3BuoLhr-V6xjFWau7eQxeGiw@mail.gmail.com>
Date: Thu, 21 Dec 2023 17:34:21 -0500
From: Paul Moore <paul@...l-moore.com>
To: Mark Brown <broonie@...nel.org>
Cc: James Morris <jmorris@...ei.org>, "Serge E. Hallyn" <serge@...lyn.com>,
Kees Cook <keescook@...omium.org>, "Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, Aishwarya TCV <aishwarya.tcv@....com>
Subject: Re: [PATCH] lsm: Add a __counted_by() annotation to lsm_ctx.ctx
On Thu, Dec 21, 2023 at 3:39 PM Mark Brown <broonie@...nel.org> wrote:
>
> The ctx in struct lsm_ctx is an array of size ctx_len, tell the compiler
> about this using __counted_by() where supported to improve the ability to
> detect overflow issues.
>
> Reported-by: Aishwarya TCV <aishwarya.tcv@....com>
> Signed-off-by: Mark Brown <broonie@...nel.org>
> ---
> include/uapi/linux/lsm.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/lsm.h b/include/uapi/linux/lsm.h
> index f0386880a78e..4150333d224f 100644
> --- a/include/uapi/linux/lsm.h
> +++ b/include/uapi/linux/lsm.h
> @@ -36,7 +36,7 @@ struct lsm_ctx {
> __u64 flags;
> __u64 len;
> __u64 ctx_len;
> - __u8 ctx[];
> + __u8 ctx[] __counted_by(ctx_len);
> };
We also now need to include stddef.h in lsm.h for the __counted_by() macro, yes?
--
paul-moore.com
Powered by blists - more mailing lists