From: Christian Brauner <christian.brauner@ubuntu.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Andy Lutomirski <luto@kernel.org>,
Tycho Andersen <tycho@tycho.ws>,
Matt Denton <mpdenton@google.com>,
Sargun Dhillon <sargun@sargun.me>, Jann Horn <jannh@google.com>,
Chris Palmer <palmer@google.com>,
Aleksa Sarai <cyphar@cyphar.com>,
Robert Sesek <rsesek@google.com>,
Jeffrey Vander Stoep <jeffv@google.com>,
Linux Containers <containers@lists.linux-foundation.org>
Subject: Re: [PATCH 1/2] seccomp: notify user trap about unused filter
Date: Thu, 28 May 2020 16:39:57 +0200 [thread overview]
Message-ID: <20200528143957.lhyjorrfqrexjurz@wittgenstein> (raw)
In-Reply-To: <20200528141658.dfjple4zddzkc3bj@wittgenstein>
On Thu, May 28, 2020 at 04:17:00PM +0200, Christian Brauner wrote:
> On Wed, May 27, 2020 at 06:59:54PM -0700, Kees Cook wrote:
> > On Thu, May 28, 2020 at 01:16:46AM +0200, Christian Brauner wrote:
> > > I'm also starting to think this isn't even possible or currently doable
> > > safely.
> > > The fdtable in the kernel would end up with a dangling pointer, I would
> > > think. Unless you backtrack all fds that still have a reference into the
> > > fdtable and refer to that file and close them all in the kernel which I
> > > don't think is possible and also sounds very dodgy. This also really
> > > seems like we would be breaking a major contract, namely that fds stay
> > > valid until userspace calls close, execve(), or exits.
> >
> > Right, I think I was just using the wrong words? I was looking at it
> > like a pipe, or a socket, where you still have an fd, but reads return
> > 0, you might get SIGPIPE, etc. The VFS clearly knows what a
> > "disconnected" fd is, and I had assumed there was general logic for it
> > to indicate "I'm not here any more".
> >
> > I recently did something very similar to the pstore filesystem, but I got
> > to cheat with some massive subsystem locks. In that case I needed to clear
> > all the inodes out of the tmpfs, so I unlink them all and manage the data
> > lifetimes pointing back into the (waiting to be unloaded) backend module
> > by NULLing the pointer back, which is safe because of the how the locking
> > there happens to work. Any open readers, when they close, will have the
> > last ref count dropped, at which point the record itself is released too.
> >
> > Back to the seccomp subject: should "all tasks died" be distinguishable
> > from "I can't find that notification" in the ioctl()? (i.e. is ENOENT
> > sufficient, or does there need to be an EIO or ESRCH there?)
>
> I personally think it's fine as it is but as it might help users if we
> reported ESRCH something like the patch below might do.
> Actual cleanup of the notifier should still happen in
> seccomp_notify_release() imho, and not in __poll_t both conceptually and
> also because f_op->release() happens on finaly fput() which punts it to
> task_work() which finishes when the task returns from kernel mode (or
> exits) - or - if the task is not alive anymore just puts it on the
> kernel global workqueue which is perfect for non-high-priority cleanup
> stuff. It's better than making __poll_t heavier than it needs to be.
> Unless there's an obvious reason not to.
Scratch the patch I posted before here; it's garbage of course.
next prev parent reply other threads:[~2020-05-28 14:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 11:19 Christian Brauner
2020-05-27 11:19 ` [PATCH 2/2] tests: test seccomp filter notifications Christian Brauner
2020-05-27 15:25 ` [PATCH 1/2] seccomp: notify user trap about unused filter Tycho Andersen
2020-05-27 15:35 ` Christian Brauner
2020-05-27 17:37 ` Sargun Dhillon
2020-05-27 19:13 ` Christian Brauner
2020-05-27 21:43 ` Kees Cook
2020-05-27 21:52 ` Tycho Andersen
2020-05-27 22:36 ` Kees Cook
2020-05-27 22:56 ` Tycho Andersen
2020-05-28 1:50 ` Kees Cook
2020-05-27 22:05 ` Christian Brauner
2020-05-27 22:37 ` Kees Cook
2020-05-27 22:45 ` Christian Brauner
2020-05-27 23:16 ` Christian Brauner
2020-05-28 1:59 ` Kees Cook
2020-05-28 4:14 ` Jann Horn
2020-05-28 14:16 ` Christian Brauner
2020-05-28 14:39 ` Christian Brauner [this message]
2020-05-28 1:49 ` Kees Cook
2020-05-28 4:04 ` Jann Horn
2020-05-28 9:57 ` Christian Brauner
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=20200528143957.lhyjorrfqrexjurz@wittgenstein \
--to=christian.brauner@ubuntu.com \
--cc=containers@lists.linux-foundation.org \
--cc=cyphar@cyphar.com \
--cc=jannh@google.com \
--cc=jeffv@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mpdenton@google.com \
--cc=palmer@google.com \
--cc=rsesek@google.com \
--cc=sargun@sargun.me \
--cc=tycho@tycho.ws \
/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
all inboxes | Powered by JetHome®