[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aTGmOGTNndl3oTk7@tycho.pizza>
Date: Thu, 4 Dec 2025 08:18:16 -0700
From: Tycho Andersen <tycho@...nel.org>
To: Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>
Cc: kees@...nel.org, linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
Andy Lutomirski <luto@...capital.net>,
Will Drewry <wad@...omium.org>, Jonathan Corbet <corbet@....net>,
Shuah Khan <shuah@...nel.org>, Aleksa Sarai <cyphar@...har.com>,
Andrei Vagin <avagin@...il.com>,
Christian Brauner <brauner@...nel.org>,
Stéphane Graber <stgraber@...raber.org>
Subject: Re: [PATCH v2 4/6] seccomp: handle multiple listeners case
On Wed, Dec 03, 2025 at 04:29:49PM +0100, Aleksandr Mikhalitsyn wrote:
> On Tue, Dec 2, 2025 at 12:52 PM Alexander Mikhalitsyn
> <aleksandr.mikhalitsyn@...onical.com> wrote:
> >
> > If we have more than one listener in the tree and lower listener
> > wants us to continue syscall (SECCOMP_USER_NOTIF_FLAG_CONTINUE)
> > we must consult with upper listeners first, otherwise it is a
> > clear seccomp restrictions bypass scenario.
> >
> > Cc: linux-kernel@...r.kernel.org
> > Cc: bpf@...r.kernel.org
> > Cc: Kees Cook <kees@...nel.org>
> > Cc: Andy Lutomirski <luto@...capital.net>
> > Cc: Will Drewry <wad@...omium.org>
> > Cc: Jonathan Corbet <corbet@....net>
> > Cc: Shuah Khan <shuah@...nel.org>
> > Cc: Aleksa Sarai <cyphar@...har.com>
> > Cc: Tycho Andersen <tycho@...ho.pizza>
> > Cc: Andrei Vagin <avagin@...il.com>
> > Cc: Christian Brauner <brauner@...nel.org>
> > Cc: Stéphane Graber <stgraber@...raber.org>
> > Reviewed-by: Tycho Andersen (AMD) <tycho@...nel.org>
> > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>
> > ---
> > kernel/seccomp.c | 33 +++++++++++++++++++++++++++++++--
> > 1 file changed, 31 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> > index ded3f6a6430b..262390451ff1 100644
> > --- a/kernel/seccomp.c
> > +++ b/kernel/seccomp.c
> > @@ -448,8 +448,21 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
> >
> > if (ACTION_ONLY(cur_ret) < ACTION_ONLY(ret)) {
> > ret = cur_ret;
> > + /*
> > + * No matter what we had before in matches->filters[],
> > + * we need to overwrite it, because current action is more
> > + * restrictive than any previous one.
> > + */
> > matches->n = 1;
> > matches->filters[0] = f;
> > + } else if ((ACTION_ONLY(cur_ret) == ACTION_ONLY(ret)) &&
> > + ACTION_ONLY(cur_ret) == SECCOMP_RET_USER_NOTIF) {
>
> My bad. We also have to check f->notif in there like that:
For my own education: why is that? Shouldn't
seccomp_do_user_notification() be smart enough to catch this case (and
indeed, there is a TOCTOU if you do it here?)?
Thanks,
Tycho
Powered by blists - more mailing lists