[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgvSB6CKAhF5IXFj@casper.infradead.org>
Date: Tue, 15 Feb 2022 16:17:11 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Miklos Szeredi <miklos@...redi.hu>,
Xavier Roche <xavier.roche@...olia.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Subject: Re: race between vfs_rename and do_linkat (mv and link)
On Tue, Feb 15, 2022 at 04:06:06PM +0000, Al Viro wrote:
> On Tue, Feb 15, 2022 at 01:37:40PM +0000, Al Viro wrote:
> > On Tue, Feb 15, 2022 at 10:56:29AM +0100, Miklos Szeredi wrote:
> >
> > > Doing "lock_rename() + lookup last components" would fix this race.
>
> "Fucking ugly" is inadequate for the likely results of that approach.
> It's guaranteed to be a source of headache for pretty much ever after.
>
> Does POSIX actually make any promises in that area? That would affect
> how high a cost we ought to pay for that - I agree that it would be nicer
> to have atomicity from userland point of view, but there's a difference
> between hard bug and QoI issue.
As I understand the original report, it relies on us hitting the nlink ==
0 at exactly the wrong moment. Can't we just restart the entire path
resolution if we find a target with nlink == 0? Sure, it's a lot of
extra work, but you've got to be trying hard to hit it in the first place.
Powered by blists - more mailing lists