Date: Wed, 27 Jan 2021 16:35:24 +0100 From: Greg Kurz Message-ID: <20210127163524.4e34596d@bahia.lan> In-Reply-To: References: <20210126103502.260758-1-stefanha@redhat.com> <20210126181604.1a4c69c6@bahia.lan> <20210127112023.0e97f909@bahia.lan> <20210127144909.22dd778e@bahia.lan> <20210127160920.062e47f0@bahia.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [Virtio-fs] [PATCH v2] virtiofsd: prevent opening of special files (CVE-2020-35517) List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Miklos Szeredi Cc: Daniel Berrange , QEMU Developers , P J P , virtio-fs-list , Alex Xu , Laszlo Ersek , Vivek Goyal On Wed, 27 Jan 2021 16:22:49 +0100 Miklos Szeredi wrote: > On Wed, Jan 27, 2021 at 4:09 PM Greg Kurz wrote: > > > > On Wed, 27 Jan 2021 15:09:50 +0100 > > Miklos Szeredi wrote: > > > The semantics of O_CREATE are that it can fail neither because the > > > file exists nor because it doesn't. This doesn't matter if the > > > exported tree is not modified outside of a single guest, because of > > > locking provided by the guest kernel. > > > > > > > Wrong. O_CREAT can legitimately fail with ENOENT if one element > > Let me make my statement more precise: > > O_CREAT cannot fail with ENOENT if parent directory exists throughout > the operation. > True, but I still don't see what guarantees guest userspace that the parent directory doesn't go away... I must have missed something. Please elaborate. > I'm sure this property is used all over the place in userspace code, > and hence should be supported in strict coherence (cache=none) mode. > > For relaxed coherence (cache=auto) I'm not quite sure. NFS is usually > the reference, we'd need to look into what guarantees it provides wrt. > O_CREAT and remote racing unlink. > > Thanks, > Miklos >