[RFC PATCH 3/3] lsm: consolidate buffer size handling into lsm_fill_user_ctx()
Paul Moore
paul at paul-moore.com
Thu Dec 21 15:21:04 UTC 2023
On Thu, Dec 21, 2023 at 8:01 AM Mark Brown <broonie at kernel.org> wrote:
> On Wed, Dec 20, 2023 at 08:40:24PM -0500, Paul Moore wrote:
> > Looking at the lsm_ctx definition in include/uapi/linux/lsm.h I see
> > the following:
>
> > struct lsm_ctx {
> > __u64 id; /* offset: 0 */
> > __u64 flags; /* offset: 8 */
> > __u64 len; /* offset: 16 */
> > __u64 ctx_len; /* offset: 24 */
> > __u8 ctx[]; /* offset: 32 */
> > };
>
> > and given that the offending line of code is trying to do a memcpy
> > into the ctx field, an offset of 32 looks correct to me.
>
> > Suggestions on how to annotate the struct, or the code doing the
> > memcpy() are welcome.
>
> You're looking for a __counted_by() annotation here I think.
Can you verify and submit a patch for that? I'm asking because my
build/toolchain configuration never produced these warnings/errors
during my testing.
--
paul-moore.com
More information about the Linux-security-module-archive
mailing list