From: "Serge E. Hallyn" <serge@hallyn.com>
To: Tycho Andersen <tycho@tycho.ws>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
Kees Cook <keescook@chromium.org>,
Andy Lutomirski <luto@amacapital.net>,
Oleg Nesterov <oleg@redhat.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
Christian Brauner <christian@brauner.io>,
Tyler Hicks <tyhicks@canonical.com>,
Akihiro Suda <suda.akihiro@lab.ntt.co.jp>,
Aleksa Sarai <asarai@suse.de>, Jann Horn <jannh@google.com>,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, linux-api@vger.kernel.org
Subject: Re: [PATCH v9 3/4] seccomp: add a return code to trap to userspace
Date: Mon, 3 Dec 2018 18:10:09 -0600 [thread overview]
Message-ID: <20181204001009.GA8796@mail.hallyn.com> (raw)
In-Reply-To: <20181203155211.GB3504@cisco>
On Mon, Dec 03, 2018 at 08:52:11AM -0700, Tycho Andersen wrote:
> On Sun, Dec 02, 2018 at 11:26:50PM -0600, Serge E. Hallyn wrote:
> > On Sun, Dec 02, 2018 at 08:28:26PM -0700, Tycho Andersen wrote:
> > > +struct seccomp_knotif {
> > > + /* The struct pid of the task whose filter triggered the notification */
> > > + struct task_struct *task;
> > > +
> > > + /* The "cookie" for this request; this is unique for this filter. */
> > > + u64 id;
> > > +
> > > + /*
> > > + * The seccomp data. This pointer is valid the entire time this
> > > + * notification is active, since it comes from __seccomp_filter which
> >
> > define 'active' - is a notification in state REPLIED still active?
>
> Yes,
>
> > Actually while looking at that, I came to wondering - when are knotifs
> > freed? Seems like only during seccomp_notify_release(), i.e. when the
> > tracing task stops polling for events? Is that going to be a problem?
> > Or am I misreading this?
>
> they're stack allocated in do_user_notification(). So "active" in this
> sense really means "somewhere in do_user_notification()".
D'oh! I see, thanks :)
> > > + if (ret == 0 && copy_to_user(buf, &unotif, sizeof(unotif))) {
> > > + ret = -EFAULT;
> > > +
> > > + /*
> > > + * Userspace screwed up. To make sure that we keep this
> > > + * notification alive, let's reset it back to INIT. It
> >
> > Is keeping the notification alive the right thing to do?
> >
> > If userspace has messed up in something this touchy, it seems unlikely
> > that it'll to better if we give it a do-over... I'm not sure whether
> > killing the whole thing (victim and tracer) is the right thing or not.
>
> I suppose we could do that too. I just didn't want to get into a
> situation where the notification is lost and the task is stuck because
> userspace screwed up here.
Yeah, that's probably best - I'm just trying to see whether there is
any way that this could be abused. My underactive imagination hasn't
come up with anything yet.
-serge
next prev parent reply other threads:[~2018-12-04 0:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 3:28 [PATCH v9 0/4] seccomp trap to userspace Tycho Andersen
2018-12-03 3:28 ` [PATCH v9 1/4] seccomp: hoist struct seccomp_data recalculation higher Tycho Andersen
2018-12-03 4:53 ` Serge E. Hallyn
2018-12-03 3:28 ` [PATCH v9 2/4] seccomp: switch system call argument type to void * Tycho Andersen
2018-12-03 5:01 ` Serge E. Hallyn
2018-12-04 0:03 ` Paul Moore
2018-12-04 2:07 ` kbuild test robot
2018-12-04 2:17 ` Tycho Andersen
2018-12-04 2:34 ` Tycho Andersen
2018-12-03 3:28 ` [PATCH v9 3/4] seccomp: add a return code to trap to userspace Tycho Andersen
2018-12-03 5:26 ` Serge E. Hallyn
2018-12-03 15:52 ` Tycho Andersen
2018-12-04 0:10 ` Serge E. Hallyn [this message]
2018-12-03 3:28 ` [PATCH v9 4/4] samples: add an example of seccomp user trap Tycho Andersen
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=20181204001009.GA8796@mail.hallyn.com \
--to=serge@hallyn.com \
--cc=asarai@suse.de \
--cc=christian@brauner.io \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=oleg@redhat.com \
--cc=suda.akihiro@lab.ntt.co.jp \
--cc=tycho@tycho.ws \
--cc=tyhicks@canonical.com \
/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