Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7369058imu; Thu, 27 Dec 2018 19:01:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN5+4pW2+6KtzYS0uIzbie8RwTuBWsWjynt1aYPyUiL7Pc94NVDFQ1YuH5RHEjds7kYClbU1 X-Received: by 2002:a63:62c4:: with SMTP id w187mr22898862pgb.230.1545966073726; Thu, 27 Dec 2018 19:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545966073; cv=none; d=google.com; s=arc-20160816; b=Ia9+bPESAW1C4Tm22sSJoiF92iPOj+AGQbNst2XJ17Iejjr2meURMzgSzCbfyejRaA 6IJ/ck7q3nHnFvWtA4kHnsJqfyD+TsU0gRAM8DvebqhXWPQK2pjVyC5bOI/DAADCjSZ8 +g6SbDtwmy/TWDyuBLWrDeBAIZkjLqO9tdoRrJ+D91hWDnk/fZtRc6u7IvxHOri/pu8x P90s5HLq31Y0F8v9kl9sXlixbdjgsImeuWzK/cR6U16JBUeC+HA0JOmGnuzJa4zfL6So 33gUYANA47C0DQhBntj0eido8rBhr79zTf3KJVN/7R/8WFzM+uX4wpCPDgdE7y6fFki8 19Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:date:references:subject:cc:to:from; bh=K4SngZJJCuObW2pUU7z0Vy2OoD16A1lHrQrckJOsY+o=; b=Ssj8ibhTKL7oAeiW0P1ru+DqzT0i6y37U3O8GabOWEZ1BGRcwj7ZxxEBsnNg0xKOHb u39I94IQIdcztGHnXolaKOXSVf6hb0ZJBZlkc0AKHRZyJiLwS9nZHlfzqWF8tZqgcV7g +bjN7xLHWnHcY3wkkyyZZDs8age+hfTRpMWlTy+Z8wZnFQF1/RF9byxiboWikLw5Ptgp ypFYl7kqj0Lm43kofEBMsaN3MsDylGQKnqb3Wba93/YFQko2tp4M3blIdLC1t7AEUNcm hXHABhYOMa7O4wdFlhJLBxGUMeamWP5MIBnZr6UC3LsFu8i7nsNtB4z0V59AnmBLWatJ k0qA== 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 2si36876412pla.156.2018.12.27.19.00.58; Thu, 27 Dec 2018 19:01:13 -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 S1726123AbeL0R4G convert rfc822-to-8bit (ORCPT + 99 others); Thu, 27 Dec 2018 12:56:06 -0500 Received: from albireo.enyo.de ([5.158.152.32]:48474 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbeL0R4F (ORCPT ); Thu, 27 Dec 2018 12:56:05 -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 1gcZt4-0005Ag-5F; Thu, 27 Dec 2018 17:56:02 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.89) (envelope-from ) id 1gcZt4-0001kn-2M; Thu, 27 Dec 2018 18:56:02 +0100 From: Florian Weimer To: Andy Lutomirski Cc: linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, libc-alpha@sourceware.org, qemu-devel@nongnu.org, ericvh@gmail.com, lucho@ionkov.net, hpa@zytor.com, arnd@arndb.de Subject: Re: d_off field in struct dirent and 32-on-64 emulation References: <87bm56vqg4.fsf@mid.deneb.enyo.de> Date: Thu, 27 Dec 2018 18:56:02 +0100 In-Reply-To: (Andy Lutomirski's message of "Thu, 27 Dec 2018 10:38:10 -0700") Message-ID: <87wonuua4t.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski: >> On Dec 27, 2018, at 10:18 AM, Florian Weimer wrote: >> >> We have a bit of an interesting problem with respect to the d_off >> field in struct dirent. >> >> When running a 64-bit kernel on certain file systems, notably ext4, >> this field uses the full 63 bits even for small directories (strace -v >> output, wrapped here for readability): >> >> getdents(3, [ >> {d_ino=1494304, d_off=3901177228673045825, d_reclen=40, >> d_name="authorized_keys", d_type=DT_REG}, >> {d_ino=1494277, d_off=7491915799041650922, d_reclen=24, d_name=".", >> d_type=DT_DIR}, >> {d_ino=1314655, d_off=9223372036854775807, d_reclen=24, >> d_name="..", d_type=DT_DIR} >> ], 32768) = 88 >> >> When running in 32-bit compat mode, this value is somehow truncated to >> 31 bits, for both the getdents and the getdents64 (!) system call (at >> least on i386). > > I imagine you’re encountering this bug: > > https://lkml.org/lkml/2018/10/18/859 It's definitely in this area. However, the original collision problem with 32-bit hashes is also real, so I can see the desire to use more bits. > Presumably the right fix involves modifying the relevant VFS file > operations to indicate the relevant ABI to the implementations. Not sure. How does NFS solve this problem when access happens from a 32-bit process and the rest (client kernel, transport, server kernel) is 64-bit all the way? > I would guess that 9p is triggering the “not really in the syscall you > think you’re in” issue. I think the issue is more like the networking case for 9p. In this scenario, the server shouldn't have to care whether the client process is in 32-bit mode or 64-bit mode. But maybe the only solution is to pass through some sort of flag, as Peter Maydell has just suggested.