[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f8dca9d2-6e5e-4584-88b3-f71f62988dab@app.fastmail.com>
Date: Thu, 12 Jan 2023 15:40:00 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Casey Schaufler" <casey@...aufler-ca.com>,
casey.schaufler@...el.com, "Paul Moore" <paul@...l-moore.com>,
linux-security-module@...r.kernel.org
Cc: jmorris@...ei.org, "Kees Cook" <keescook@...omium.org>,
john.johansen@...onical.com,
"Tetsuo Handa" <penguin-kernel@...ove.sakura.ne.jp>,
stephen.smalley.work@...il.com, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, mic@...ikod.net
Subject: Re: [PATCH v5 4/8] LSM: lsm_get_self_attr syscall for LSM self attributes
On Mon, Jan 9, 2023, at 19:07, Casey Schaufler wrote:
> +/**
> + * struct lsm_ctx - LSM context
> + * @id: the LSM id number, see LSM_ID_XXX
> + * @flags: context specifier and LSM specific flags
> + * @ctx_len: the size of @ctx
> + * @ctx: the LSM context, a nul terminated string
> + *
> + * @ctx in a nul terminated string.
> + * (strlen(@ctx) < @ctx_len) is always true.
> + * (strlen(@ctx) == @ctx_len + 1) is not guaranteed.
> + */
> +struct lsm_ctx {
> + __u32 id;
> + __u64 flags;
> + __kernel_size_t ctx_len;
> + __u8 ctx[];
> +};
I think this should be changed to be the same layout on
all architectures regardless of __u64 alignment and
sizeof(__kernel_size_t) differences, to avoid the need
for compat syscalls and explicit clearing of the
internal padding.
Maybe just use __u64 fields for all three integers?
Arnd
Powered by blists - more mailing lists