lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Sep 2018 16:49:51 -0600
From:   Tycho Andersen <tycho@...ho.ws>
To:     Jann Horn <jannh@...gle.com>
Cc:     Kees Cook <keescook@...omium.org>,
        kernel list <linux-kernel@...r.kernel.org>,
        containers@...ts.linux-foundation.org,
        Linux API <linux-api@...r.kernel.org>,
        Andy Lutomirski <luto@...capital.net>,
        Oleg Nesterov <oleg@...hat.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        Christian Brauner <christian.brauner@...ntu.com>,
        Tyler Hicks <tyhicks@...onical.com>,
        suda.akihiro@....ntt.co.jp, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v7 5/6] seccomp: add a way to pass FDs via a notification
 fd

On Fri, Sep 28, 2018 at 12:17:07AM +0200, Jann Horn wrote:
> On Fri, Sep 28, 2018 at 12:14 AM Tycho Andersen <tycho@...ho.ws> wrote:
> > On Thu, Sep 27, 2018 at 09:28:07PM +0200, Jann Horn wrote:
> > > On Thu, Sep 27, 2018 at 5:11 PM Tycho Andersen <tycho@...ho.ws> wrote:
> > > > This patch adds a way to insert FDs into the tracee's process (also
> > > > close/overwrite fds for the tracee). This functionality is necessary to
> > > > mock things like socketpair() or dup2() or similar, but since it depends on
> > > > external (vfs) patches, I've left it as a separate patch as before so the
> > > > core functionality can still be merged while we argue about this. Except
> > > > this time it doesn't add any ugliness to the API :)
> > > [...]
> > > > +static long seccomp_notify_put_fd(struct seccomp_filter *filter,
> > > > +                                 unsigned long arg)
> > > > +{
> > > > +       struct seccomp_notif_put_fd req;
> > > > +       void __user *buf = (void __user *)arg;
> > > > +       struct seccomp_knotif *knotif = NULL;
> > > > +       long ret;
> > > > +
> > > > +       if (copy_from_user(&req, buf, sizeof(req)))
> > > > +               return -EFAULT;
> > > > +
> > > > +       if (req.fd < 0 && req.to_replace < 0)
> > > > +               return -EINVAL;
> > > > +
> > > > +       ret = mutex_lock_interruptible(&filter->notify_lock);
> > > > +       if (ret < 0)
> > > > +               return ret;
> > > > +
> > > > +       ret = -ENOENT;
> > > > +       list_for_each_entry(knotif, &filter->notif->notifications, list) {
> > > > +               struct file *file = NULL;
> > > > +
> > > > +               if (knotif->id != req.id)
> > > > +                       continue;
> > >
> > > Are you intentionally permitting non-SENT states here? It shouldn't
> > > make a big difference, but I think it'd be nice to at least block the
> > > use of notifications in SECCOMP_NOTIFY_REPLIED state.
> >
> > Agreed, I'll block everything besides REPLIED.
> 
> Do you mean SENT? In REPLIED state, seccomp_notify_put_fd()
> is racy because the target task is in the process of waking up, right?

Yes, sorry, I mean SENT.

Tycho

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ