Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9300878imu; Sat, 29 Dec 2018 15:47:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN6GwbfZnPUpxvYeDXAf56YLc8gvd6V0hyav98pfWhBX/HMFOt479GsOhY1zSZjzLC06syiz X-Received: by 2002:a63:960a:: with SMTP id c10mr3003470pge.106.1546127239383; Sat, 29 Dec 2018 15:47:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546127239; cv=none; d=google.com; s=arc-20160816; b=vvGx1uk29YTvW81P9NN2ohBIru3AjtFNttpdQpGPLG9xTP5CXwczVgYdzayrkCAJPO Gww3cd8xP8cm41sgm4B6vx/B4npvTfzscDSamRzO6+YoHU8VssADz7KjoKwEZ8OKCS1w EWjGTbfoNYrvItXaTEGrCpu42LGploEJdQWJPgvGgSI5sOybb59qWqKhdcLmFkHkL0rW zzWNYCu9zO1SdPoBGi2dLoMQCthKILcD28NNcYCUMNVuVnMUWt8+Mnuhwm6z7P9OwEld jWIBq4kN0c4GM6TF/nORHa9xMMZQ6W3LRhL8e4+alEyWQoGX992sz4eb1XSjJIUWiQSX V0lA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=JRkaqRVzSYl/d4c/bn4m0sgjR50jM01FPPdxTNs6HGQ=; b=PQyOefNIbexYxnH8pIfwIyO/cg/yWLTquErJb5OCEmWJ50U5E0+D5yb8QsOib25Hyv RgyradC4Egmv5GhzDAeWHsPFIQ9JovMYdMh2Qia2FLklXxfoq+9i3EWKZGRdl80WrLzA ilGclHd2tZHf+/PBBYBDXXhWAfje9YVHjajG+tj9pDJy+xVe2/xtpORIa1hajK1+Nzmu c/48hpx61n6nQ1OxPwzd/L95JbYoBPCRAtAPPINqPa1bXFxeBou0sgO3XTfXq6pZAwHN OjocXXQz5CM1o1DFID4yRjAmMnIEptIHFqHEJTsOMMSCPZHghKlBVid4/tXkBMP0qHIH 5QGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iwTeC8ep; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si38001935pgv.33.2018.12.29.15.47.03; Sat, 29 Dec 2018 15:47:19 -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; dkim=pass header.i=@kernel.org header.s=default header.b=iwTeC8ep; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727413AbeL2Qtf (ORCPT + 99 others); Sat, 29 Dec 2018 11:49:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:51304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726644AbeL2Qtf (ORCPT ); Sat, 29 Dec 2018 11:49:35 -0500 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D519121908 for ; Sat, 29 Dec 2018 16:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546102174; bh=mMN6xBzLLeHIs79oTtJhx2Vtm0hgPai1doa5+uzb9ic=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iwTeC8epy4/VrlO/x5hBZlgjcjHqThxDfP9I2Pk9vzdLZJustDPwMj4DlACfl16VH +vxuANxgZl0MKnyP+LYKWpjGqDmIisI8H7WsUazj4s04/tbZgJhNj5Sky7SQnlO3xI rmDNNLTXunK3X8ZLthccrdHlM8vRL9CX4Ij52Ysw= Received: by mail-wm1-f44.google.com with SMTP id y139so20843591wmc.5 for ; Sat, 29 Dec 2018 08:49:33 -0800 (PST) X-Gm-Message-State: AA+aEWZaV/fTDeu+swgjBPc35wRaX/RAG2mpVeLHpMjIqEOqY2CtCL8+ lH+mJCagkoaB+gY64HoYbMFK42br+tGw+GH/zNrgGQ== X-Received: by 2002:a1c:f112:: with SMTP id p18mr25816261wmh.83.1546102172181; Sat, 29 Dec 2018 08:49:32 -0800 (PST) MIME-Version: 1.0 References: <87bm56vqg4.fsf@mid.deneb.enyo.de> <9C6A7D45-CF53-4C61-B5DD-12CA0D419972@dilger.ca> <1EF1B31A-83D8-4642-BEBF-F56E45485223@dilger.ca> <20181229015453.GA6310@bombadil.infradead.org> In-Reply-To: <20181229015453.GA6310@bombadil.infradead.org> From: Andy Lutomirski Date: Sat, 29 Dec 2018 08:49:19 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Qemu-devel] d_off field in struct dirent and 32-on-64 emulation To: Matthew Wilcox Cc: Peter Maydell , Andreas Dilger , Florian Weimer , linux-fsdevel , Linux API , Ext4 Developers List , Latchesar Ionkov , libc-alpha , Arnd Bergmann , Eric Van Hensbergen , "H. Peter Anvin" , lkml - Kernel Mailing List , QEMU Developers , Ron Minnich , V9FS Developers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Dec 28, 2018, at 6:54 PM, Matthew Wilcox wrote: > >> On Sat, Dec 29, 2018 at 12:12:27AM +0000, Peter Maydell wrote: >> On Fri, 28 Dec 2018 at 23:16, Andreas Dilger wrot >>> On Dec 28, 2018, at 4:18 AM, Peter Maydell w= rote: >>>> The problem is that there is no 32-bit API in some cases >>>> (unless I have misunderstood the kernel code) -- not all >>>> host architectures implement compat syscalls or allow them >>>> to be called from 64-bit processes or implement all the older >>>> syscall variants that had smaller offets. If there was a guaranteed >>>> "this syscall always exists and always gives me 32-bit offsets" >>>> we could use it. >>> >>> The "32bitapi" mount option would use 32-bit hash for seekdir >>> and telldir, regardless of what kernel API was used. That would >>> just set the FMODE_32BITHASH flag in the file->f_mode for all files. >> >> A mount option wouldn't be much use to QEMU -- we can't tell >> our users how to mount their filesystems, which they're >> often doing lots of other things with besides running QEMU. >> (Otherwise we could just tell them "don't use ext4", which >> would also solve the problem :-)) We need something we can >> use at the individual-syscall level. > > Could you use a prctl to set whether you were running in 32 or 64 bit > mode? Or do you change which kind of task you're emulating too often > to make this a good idea? How would this work? We already have the separate COMPAT_DEFINE_SYSCALL entries *and* in_compat_syscall(). Now we=E2=80=99d h= ave a third degree of freedom. Either the arches people care about should add reasonable ways to issue 32-bit syscalls from 64-bit mode or there should be an explicit way to ask for the 32-bit directory offsets.