Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9023120ybl; Wed, 25 Dec 2019 11:40:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxW6PjlwyHOdwEauYCC+N9W2uJ1UEhjNDwRiZdksfGJn71cP2lfzO/OLUh7ncFRI4EFhnt4 X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr47180271otr.16.1577302828872; Wed, 25 Dec 2019 11:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577302828; cv=none; d=google.com; s=arc-20160816; b=auN6YLk4bDZaZV6WaLMkmeuenuvi9tuR+HqBYMqV9V+rQqXXjviixxvXCBrdqajwXN beF35sAEWtDLllOodEOMTWhLvmhTlsrY2szcldG11q/X+/xIRtZQfnbwMuhknMXAPSh3 Jyqvu9stHu34irGWChJT9mNmK6NiS/8LvhXCWn5dN4S/Y8SM5E4FA34wG77m57ipTyqr 3sRf1PuQWcBBD4CP7wkt/9BDaxQBuBQyzeCGYGvHtMkR8g6vO6McJZ+ckO5bO0D2Us+U o6w6r0FzqrclGfgFlxcwVWCj1u2yGq1MpAJYZWC52w/0yleF36iS07gvm6m2Rr1RGX+n o4+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to:date :references:subject:cc:to:from; bh=Sgh22uq76sq9ZsUJOTNhCng3PL+CvtXxH1go0SXJjfY=; b=A+swLOFzGW3p75SVUspoT7+FegiLXmoJe9VvvHDF/B9x0mf/HhiJ99NuB99f3546nb TgBRMwkkZcNlYrOoo3zuQ+WxcPs+PthF5PK9h2PguqsHl73Mo15WZCf9ksUMk09F0No+ NnYLW15YvmH1X+Qlzm38MfrTQjncMcY591hYNR3H3pBr5RLbpzmfVebpQlV7OS31htWi ua3nhCNemV7Lre91q79/ZvnGv0f+/0dxoAAdQMk+DOIizSBeAcb4jRNJ8GrcqwvhzJ5b 2JujUB5aBg5901U6Lh6y9gjtoCWE9GCIM4SuYjr784C0RBYhHjPyz6oSX+ItB5ueT2Qn VJDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u125si13648192oif.130.2019.12.25.11.40.07; Wed, 25 Dec 2019 11:40:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726866AbfLYTjB (ORCPT + 99 others); Wed, 25 Dec 2019 14:39:01 -0500 Received: from albireo.enyo.de ([37.24.231.21]:43874 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726420AbfLYTjB (ORCPT ); Wed, 25 Dec 2019 14:39:01 -0500 Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1ikCUh-000786-Vl; Wed, 25 Dec 2019 19:38:55 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1ikCTv-0004Mj-Rz; Wed, 25 Dec 2019 20:38:07 +0100 From: Florian Weimer To: "Theodore Y. Ts'o" Cc: Rich Felker , linux-fsdevel@vger.kernel.org, musl@lists.openwall.com, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org Subject: Re: [musl] getdents64 lost direntries with SMB/NFS and buffer size < unknown threshold References: <20191120001522.GA25139@brightrain.aerifal.cx> <8736eiqq1f.fsf@mid.deneb.enyo.de> <20191120205913.GD16318@brightrain.aerifal.cx> <20191121175418.GI4262@mit.edu> Date: Wed, 25 Dec 2019 20:38:07 +0100 In-Reply-To: <20191121175418.GI4262@mit.edu> (Theodore Y. Ts'o's message of "Thu, 21 Nov 2019 12:54:18 -0500") Message-ID: <87a77g2o2o.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Theodore Y. Ts'o: > On Wed, Nov 20, 2019 at 03:59:13PM -0500, Rich Felker wrote: >> >> POSIX only allows both behaviors (showing or not showing) the entry >> that was deleted. It does not allow deletion of one entry to cause >> other entries not to be seen. > > Agreed, but POSIX requires this of *readdir*. POSIX says nothing > about getdents64(2), which is Linux's internal implementation which is > exposed to a libc. Sure, but Linux better provides some reasonable foundation for a libc. I mean, sure, we can read the entire directory into RAM on the first readdir, and get a fully conforming implementation this way (and as Rich noted, glibc's 32 KiB buffer tends to approximate that in practice). But that doesn't strike me as particularly useful. The POSIX requirement is really unfortunate because it leads to incorrect implementations of rm -rf which would on a compliant system and fail in practice. > So we would need to see what is exactly going on at the interfaces > between the VFS and libc, the nfs client code and the VFS, the nfs > client code and the nfs server, and possibly the behavior of the nfs > server. > > First of all.... you can't reproduce this on anything other than with > NFS, correct? That is, does it show up if you are using ext4, xfs, > btrfs, etc.? I'm sure it shows up with certain directory contents on any Linux file system except for those that happen to have a separate B-tree (or equivalent) for telldir/seekdir support. And even those will have broken corner case in case of billions of directory operations. 32 bits are simply not enough storage space for the cookie. Hashing just masks the presence of these bugs, but does not eliminate them completely.