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] [day] [month] [year] [list]
Message-ID: <202012011322.26DCBC64F2@keescook>
Date:   Tue, 1 Dec 2020 13:27:05 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Tycho Andersen <tycho@...ho.pizza>
Cc:     Sargun Dhillon <sargun@...gun.me>, Alban Crequy <alban@...volk.io>,
        Giuseppe Scrivano <gscrivan@...hat.com>,
        Linux Containers <containers@...ts.linux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>, jannh@...gle.com
Subject: Re: SECCOMP_IOCTL_NOTIF_ADDFD race condition

On Tue, Dec 01, 2020 at 08:13:34AM -0500, Tycho Andersen wrote:
> On Tue, Dec 01, 2020 at 01:08:25PM +0000, Sargun Dhillon wrote:
> > On Tue, Dec 01, 2020 at 07:41:05AM -0500, Tycho Andersen wrote:
> > > On Mon, Nov 30, 2020 at 06:20:09PM -0500, Tycho Andersen wrote:
> > > > Idea 1 sounds best to me, but maybe that's because it's the way I
> > > > originally did the fd support that never landed :)
> > > > 
> > > > But here's an Idea 4: we add a way to remotely close an fd (I don't
> > > > see that the current infra can do this, but perhaps I didn't look hard
> > > > enough), and then when you get ENOENT you have to close the fd. Of
> > > > course, this can't be via seccomp, so maybe it's even more racy.
> > > 
> > > Or better yet: what if the kernel closed everything it had added via
> > > ADDFD if it didn't get a valid response from the supervisor? Then
> > > everyone gets this bug fixed for free.
> > > 
> > > Tycho
> > > _______________________________________________
> > > Containers mailing list
> > > Containers@...ts.linux-foundation.org
> > > https://lists.linuxfoundation.org/mailman/listinfo/containers
> > 
> > This doesn't solveĀ the problem universally because of the (Go) preemption 
> > problem. Unless we can guarantee that the supervisor can always handle the 
> > request in fewer than 10ms, or if it implements resumption behaviour. I know 
> > that resumption behaviour is a requirement no matter what, but the easier we can 
> > make it to implement resumption, the better chance we are giving users to get 
> > this right.
> 
> Doesn't automatic cleanup of fds make things easier? I'm not sure I
> understand the argument.

I doubt Al would ever allow the "cleanup" approach: his observation was
that the instant a file has been added to the fdtable, it's not possible
to "unwind" that ever, since it could be cloned away, etc, etc.

> I agree it doesn't fix the problem of uncooperative userspace.

IIUC, I see two issues:

- a slow monitor might cause a child to loop forever retrying the same
  interrupted syscall.

- a syscall-interrupted process may have had an fd added that it has no
  idea about.

The former problem seems like a userspace issue. :P But, to help, yeah, is
signal blocking best? Either explicit (at filter apply time) or implicit
(all user_notif-triggering syscalls get all signals blocks automatically)?

For the latter problem, I think we need to get back to Tycho's original
method: add fd and finish syscall in a single action. I can't see any
other way to get around the need for atomicity...

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ