From: Christian Brauner <christian@brauner.io>
To: tycho@tycho.ws, keescook@chromium.org, luto@amacapital.net,
jannh@google.com, linux-kernel@vger.kernel.org,
stgraber@ubuntu.com
Subject: SECCOMP_RET_USER_NOTIF: listener improvements
Date: Wed, 24 Apr 2019 17:04:26 +0200 [thread overview]
Message-ID: <20190424150423.k3embc2vkho2kixp@brauner.io> (raw)
[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]
Hey everyone,
So I was working on making use of the seccomp listener stuff and I
stumbled upon a problem. Imagine a scenario where:
1. Task T1 installs Filter F1 and gets and listener fd for that filter FD1
2. T1 sends FD1 via SCM_RIGHTS to task T2
T2 now holds a reference to the same underlying struct file as FD1 via FD2
3. T2 registers FD2 in an event loop and starts listening for events
4. T1 exits and wipes FD1
Now, T2 still holds a reference to the filter via FD2 which references
the same underlying file as FD1 which has the seccomp filter stashed in
private_data.
So T2 will never get notified that the filter is essentially unused and
doesn't know when to exit, i.e. it has no way of telling when T1 and all
of its children using the same filter are gone.
I think we should have a way to do this *or* alternatively have a way to
attach a process to an existing filter.
The scenario described above arises pretty naturally on container
attach. The standard way of doing this is usually
fork() + attach_namespaces() + clone(CLONE_PARENT) where you don't
share the filter of container's init. So the seccomp context has to be
recreated. [1]
Opinions?
Christian
[1]: Note, that systemd-nspawn is creating the process by talking
to the container's systemd and requesting it runs the programs via
transient units but this only works if systemd is run inside the
container and if you trust the workload.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2019-04-24 15:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 15:04 Christian Brauner [this message]
2019-04-24 15:20 ` Tycho Andersen
2019-04-24 15:23 ` Christian Brauner
2019-04-24 15:27 ` 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=20190424150423.k3embc2vkho2kixp@brauner.io \
--to=christian@brauner.io \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=stgraber@ubuntu.com \
--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®