From: "Mickaël Salaün" <mic@digikod.net>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: "John Johansen" <john.johansen@canonical.com>,
"Paul Moore" <paul@paul-moore.com>,
"Maxime Bélair" <maxime.belair@canonical.com>,
"Tetsuo Handa" <penguin-kernel@i-love.sakura.ne.jp>,
linux-security-module@vger.kernel.org, jmorris@namei.org,
serge@hallyn.com, kees@kernel.org,
stephen.smalley.work@gmail.com, takedakn@nttdata.co.jp,
linux-api@vger.kernel.org, apparmor@lists.ubuntu.com,
linux-kernel@vger.kernel.org, "Arnd Bergmann" <arnd@arndb.de>
Subject: Re: [PATCH 2/3] lsm: introduce security_lsm_manage_policy hook
Date: Fri, 9 May 2025 12:26:45 +0200 [thread overview]
Message-ID: <20250509.Chuecae0phoo@digikod.net> (raw)
In-Reply-To: <efe5b15a-6141-424a-8391-9092e79e4acf@schaufler-ca.com>
On Thu, May 08, 2025 at 09:54:19AM -0700, Casey Schaufler wrote:
> On 5/8/2025 1:29 AM, John Johansen wrote:
> > On 5/7/25 13:25, Paul Moore wrote:
> >> On Wed, May 7, 2025 at 6:41 AM Tetsuo Handa
> >> <penguin-kernel@i-love.sakura.ne.jp> wrote:
> >>> On 2025/05/06 23:32, Maxime Bélair wrote:
> >>>> diff --git a/security/lsm_syscalls.c b/security/lsm_syscalls.c
> >>>> index dcaad8818679..b39e6635a7d5 100644
> >>>> --- a/security/lsm_syscalls.c
> >>>> +++ b/security/lsm_syscalls.c
> >>>> @@ -122,5 +122,10 @@ SYSCALL_DEFINE3(lsm_list_modules, u64 __user
> >>>> *, ids, u32 __user *, size,
> >>>> SYSCALL_DEFINE5(lsm_manage_policy, u32, lsm_id, u32, op, void
> >>>> __user *, buf, u32
> >>>> __user *, size, u32, flags)
> >>>> {
> >>>> - return 0;
> >>>> + size_t usize;
> >>>> +
> >>>> + if (get_user(usize, size))
> >>>> + return -EFAULT;
> >>>> +
> >>>> + return security_lsm_manage_policy(lsm_id, op, buf, usize,
> >>>> flags);
> >>>> }
> >>>
> >>> syzbot will report user-controlled unbounded huge size memory
> >>> allocation attempt. ;-)
> >>>
> >>> This interface might be fine for AppArmor, but TOMOYO won't use this
> >>> interface because
> >>> TOMOYO's policy is line-oriented ASCII text data where the
> >>> destination is switched via
> >>> pseudo‑filesystem's filename ...
> >>
> >> While Tetsuo's comment is limited to TOMOYO, I believe the argument
> >> applies to a number of other LSMs as well. The reality is that there
> >> is no one policy ideal shared across LSMs and that complicates things
> >> like the lsm_manage_policy() proposal. I'm intentionally saying
> >> "complicates" and not "prevents" because I don't want to flat out
> >> reject something like this, but I think there needs to be a larger
> >> discussion among the different LSM groups about what such an API
> >> should look like. We may not need to get every LSM to support this
> >> new API, but we need to get something that would work for a
> >> significant majority and would be general/extensible enough that we
> >> would expect it to work with the majority of future LSMs (as much as
> >> we can predict the future anyway).
> >>
> >
> > yep, I look at this is just a starting point for discussion. There
> > isn't going to be any discussion without some code, so here is a v1
> > that supports a single LSM let the bike shedding begin.
>
> Aside from the issues with allocating a buffer for a big policy
> I don't see a problem with this proposal. The system call looks
> a lot like the other LSM interfaces, so any developer who likes
> those ought to like this one. The infrastructure can easily check
> the lsm_id and only call the appropriate LSM hook, so no one
> is going to be interfering with other modules.
We may not want to only be able to load buffers containing policies, but
also to leverage file descriptors like Landlock does. Getting a
property from a kernel object or updating it is mainly about dealing
with a buffer. And the current LSM syscalls do just that. Other kind
of operations may require more than that though.
I don't like multiplexer syscalls because they don't expose a clear
semantic and can be complex to manage and filter. This new syscall is
kind of a multiplexer that redirect commands to an arbitrary set of
kernel parts, which can then define their own semantic. I'd like to see
a clear set of well-defined operations and their required permission.
Even better, one syscall per operation should simplify their interface.
next prev parent reply other threads:[~2025-05-09 10:26 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 14:32 [PATCH 0/3] lsm: introduce lsm_manage_policy() syscall Maxime Bélair
2025-05-06 14:32 ` [PATCH 1/3] Wire up the lsm_manage_policy syscall Maxime Bélair
2025-05-07 6:26 ` Song Liu
2025-05-07 15:37 ` Maxime Bélair
2025-05-07 22:04 ` Tetsuo Handa
2025-05-08 7:52 ` John Johansen
2025-05-09 10:25 ` Mickaël Salaün
2025-05-11 11:09 ` John Johansen
2025-05-08 6:06 ` Song Liu
2025-05-08 8:18 ` John Johansen
2025-05-09 10:26 ` Mickaël Salaün
2025-05-11 10:47 ` John Johansen
2025-05-12 10:20 ` Mickaël Salaün
2025-05-17 7:59 ` John Johansen
2025-05-08 7:12 ` John Johansen
2025-05-07 13:58 ` kernel test robot
2025-05-06 14:32 ` [PATCH 2/3] lsm: introduce security_lsm_manage_policy hook Maxime Bélair
2025-05-07 6:19 ` Song Liu
2025-05-07 15:37 ` Maxime Bélair
2025-05-08 8:20 ` John Johansen
2025-05-07 10:40 ` Tetsuo Handa
2025-05-07 15:37 ` Maxime Bélair
2025-05-07 20:25 ` Paul Moore
2025-05-08 8:29 ` John Johansen
2025-05-08 16:54 ` Casey Schaufler
2025-05-09 10:26 ` Mickaël Salaün [this message]
2025-05-09 14:21 ` Casey Schaufler
2025-05-11 11:26 ` John Johansen
2025-05-11 11:20 ` John Johansen
2025-05-08 8:25 ` John Johansen
2025-05-08 12:55 ` Tetsuo Handa
2025-05-08 14:44 ` John Johansen
2025-05-08 15:07 ` Tetsuo Handa
2025-05-09 3:25 ` John Johansen
2025-05-07 12:04 ` kernel test robot
2025-05-06 14:32 ` [PATCH 3/3] AppArmor: add support for lsm_manage_policy Maxime Bélair
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250509.Chuecae0phoo@digikod.net \
--to=mic@digikod.net \
--cc=apparmor@lists.ubuntu.com \
--cc=arnd@arndb.de \
--cc=casey@schaufler-ca.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=kees@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=maxime.belair@canonical.com \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=serge@hallyn.com \
--cc=stephen.smalley.work@gmail.com \
--cc=takedakn@nttdata.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).