Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3730091ybz; Mon, 20 Apr 2020 08:24:47 -0700 (PDT) X-Google-Smtp-Source: APiQypIvlpLafSzb4uZ2ghxT+YdgEP/oXVuX9g9uN9IM+LMqssiX2BI0Q2hOwCgUtQm4D0eickLm X-Received: by 2002:a17:906:2443:: with SMTP id a3mr15881393ejb.291.1587396287808; Mon, 20 Apr 2020 08:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587396287; cv=none; d=google.com; s=arc-20160816; b=gJhy7lan2UN6p82cUEIdfQJwU650kwYkarXGnQQd9yCBXnwNpV5WsQZNh2Xh3pa3zs d0Mhc8Z7PTL3qqqG0fMBZRsUyiFrz7gfYfcsOqXzp2jq4NuBXyREBcBOriZ6at2GRi7N w9SvRsu+G/1Zyq5nOC3q/c2PLCur+g/vEEFjL02Pe/wVHcaKrmOI7HCohbr28lU+D380 uCzwvhr6RPbrNc0pE+120qtRhnbiP78QumQENnLfEV+dRPrPWmb/c3mwrkgTJFhaJ1Zi 03sz/B/bnAhzV/iNKTqSrPoz5brA2/1R4DeSqg3tmUG4JtGeuFllm4Jr2snnO2nKJso+ 00Nw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=y8ey1M/uqJZkOtKQsKP7oHVU1isoUNVylcTf7jiJ2so=; b=ScQlaDckvpS3RAqhs1wI2ake1AeqGA2P4d8ECjJjeucQkNRzJ1s5XJeH4lZVAg3t5e K53X0repqDK79waPNxvsvLgDgJf1TSlSr+QMueExlj64rH/ffedBmj3dsMyFHPH5r2yM arXwHi+VgDmKQW4p5OGeKTwq1RajzlXFZ5IqM0GJ35a6vF7I5XQpHKsZ/lVywMRjDTgo J/Xei+pp2NtaPCIFJknVYv7qN/XvIXM8b0IntnTyg3+qoWKw7itvZro9/6XmVwdVgLN9 lhvT+JUKYRYtlDygkE4XX242pJpb7Wayadf7/NLP7EXHgL+yseeA6/e2c9e7Zx1KLU+i 32vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vfr8FUok; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si285937edq.508.2020.04.20.08.24.23; Mon, 20 Apr 2020 08:24:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vfr8FUok; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726432AbgDTPYD (ORCPT + 99 others); Mon, 20 Apr 2020 11:24:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31705 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725937AbgDTPYD (ORCPT ); Mon, 20 Apr 2020 11:24:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587396241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y8ey1M/uqJZkOtKQsKP7oHVU1isoUNVylcTf7jiJ2so=; b=Vfr8FUokTYf3Kn/pg4kuvfKp+WxxdBoEmtDRNyPeIUln7d5pdgYtLUzvUpRWbJTDDppEgY 2H4CU759dYwcxBBbIF5Zgpsut8xOxT4y6z7yu2aJK470kZC3ZVBwmGYJ6NPrnrfg3j1YsC FXTk7VWLF6D+ZQ4WX5Nv/QClNy425nE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-MHXz6fomNpKIbV05wZeu1A-1; Mon, 20 Apr 2020 11:23:51 -0400 X-MC-Unique: MHXz6fomNpKIbV05wZeu1A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 697AD149C5; Mon, 20 Apr 2020 15:23:49 +0000 (UTC) Received: from [10.10.116.80] (ovpn-116-80.rdu2.redhat.com [10.10.116.80]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79012129F8E; Mon, 20 Apr 2020 15:23:47 +0000 (UTC) Subject: Re: [PATCH] fcntl: Add 32bit filesystem mode To: "Theodore Y. Ts'o" , Linus Walleij Cc: Peter Maydell , linux-api@vger.kernel.org, qemu-devel@nongnu.org, Florian Weimer , Andreas Dilger , Andy Lutomirski , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org References: <20200331133536.3328-1-linus.walleij@linaro.org> <20200420151344.GC1080594@mit.edu> From: Eric Blake Organization: Red Hat, Inc. Message-ID: Date: Mon, 20 Apr 2020 10:23:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200420151344.GC1080594@mit.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 4/20/20 10:13 AM, Theodore Y. Ts'o wrote: > On Tue, Mar 31, 2020 at 03:35:36PM +0200, Linus Walleij wrote: >> It was brought to my attention that this bug from 2018 was >> still unresolved: 32 bit emulators like QEMU were given >> 64 bit hashes when running 32 bit emulation on 64 bit systems. >> >> This adds a fcntl() operation to set the underlying filesystem >> into 32bit mode even if the file hanle was opened using 64bit >> mode without the compat syscalls. > > s/hanle/handle/ > > The API that you've proposed as a way to set the 32-bit mode, but > there is no way to clear the 32-bit mode, nor there is a way to get > the current status mode. > > My suggestion is to add a flag bit for F_GETFD and F_SETFD (set and > get file descriptor flags). Currently the only file descriptor flag > is FD_CLOEXEC, so why not add a FD_32BIT_MODE bit? Also, POSIX is proposing standardizing FD_CLOFORK, which would be another file descriptor flag worth considering in Linux (Solaris and BSD already have it): https://www.austingroupbugs.net/view.php?id=1318 It will be interesting to find how much code (wrongly) assumes it can use a blind assignment of fcntl(fd, F_SETFD, 1) and thereby accidentally wipes out other existing flags, when it should have instead been doing a read-modify-write to protect flags other than FD_CLOEXEC. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org