[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yq4qIxh5QnhQZ0SJ@casper.infradead.org>
Date: Sat, 18 Jun 2022 20:40:19 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Ralph Corderoy <ralph@...utplus.co.uk>
Cc: Nate Karstens <nate.karstens@...min.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jeff Layton <jlayton@...nel.org>,
"J. Bruce Fields" <bfields@...ldses.org>,
Arnd Bergmann <arnd@...db.de>,
Richard Henderson <rth@...ddle.net>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Matt Turner <mattst88@...il.com>,
"James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
Helge Deller <deller@....de>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
David Laight <David.Laight@...lab.com>,
linux-fsdevel@...r.kernel.org, linux-arch@...r.kernel.org,
linux-alpha@...r.kernel.org, linux-parisc@...r.kernel.org,
sparclinux@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Changli Gao <xiaosuo@...il.com>
Subject: Re: [PATCH v2] Implement close-on-fork
On Sat, Jun 18, 2022 at 12:41:11PM +0100, Ralph Corderoy wrote:
> Hi Nate,
>
> > One manifestation of this is a race conditions in system(), which
> > (depending on the implementation) is non-atomic in that it first calls
> > a fork() and then an exec().
>
> The need for O_CLOFORK might be made more clear by looking at a
> long-standing Go issue, i.e. unrelated to system(3), which was started
> in 2017 by Russ Cox when he summed up the current race-condition
> behaviour of trying to execve(2) a newly created file:
> https://github.com/golang/go/issues/22315. I raised it on linux-kernel
> in 2017, https://marc.info/?l=linux-kernel&m=150834137201488, and linked
> to a proposed patch from 2011, ‘[PATCH] fs: add FD_CLOFORK and
> O_CLOFORK’ by Changli Gao. As I said, long-standing.
The problem is that people advocating for O_CLOFORK understand its
value, but not its cost. Other google employees have a system which has
literally millions of file descriptors in a single process. Having to
maintain this extra state per-fd is a cost they don't want to pay
(and have been quite vocal about earlier in this thread).
Fundamentally, fork()+exec() is a terrible model. Mind you, so is
spawn(). I haven't seen a good model yet.
Powered by blists - more mailing lists