Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3821611ybz; Mon, 20 Apr 2020 10:03:28 -0700 (PDT) X-Google-Smtp-Source: APiQypIxh1mYhAf3RsNtlggZLqj/em31YkJdlObN/2ECoUNPWitQlHHD9pz39QxC12HTXKjyQ8XA X-Received: by 2002:a1c:6402:: with SMTP id y2mr317336wmb.116.1587402208119; Mon, 20 Apr 2020 10:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587402208; cv=none; d=google.com; s=arc-20160816; b=AI5ghkUDYvLPW7mGP9om8+4BQcy7Wjhr25qHievDtzQkphc05fRiTwe2aA8Mteu0mC NDL1/exUaBqDHNVxbFQ7EeQHsB/XBy32A+UCAoHrFhgw1MVwDIlLjQmOe33D8wj4u2T/ u2HULOk2HVA5gsCQwY+p12S+Y9O6gt/BNRLkLItq1u4AGz8ArHO5n01MdZd1co5oYgSI H8h43LdXhQYYARY0pYMJJ4gH2W104kB6NNsRdPop07N8wgfvnL9V6WqAI3XvyecdwccC lGof+Lz+8fsDXROk/2clo/viEK4cOM5dMWb7Bssat9M56GATKGNR2GBjyvOcWg5G2pkL hqwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JxA4qGdgvfkfP3P4HJ4/+FEuz88hGH6asO/jdK468cQ=; b=LXF3jns4rWk6BVVe+aViE/qCkeEx2G1CHBJdEjcSmXRfl2btVMkD7q/PlBhwCfWeS7 DtE3y5wNReKnRtaTefDlcKG0bT596MJ0oLKubc2yl3okyLubka+9QBvuLBevT6sE41Ys 1GcNY0R2d9881vmjLaEOtVal5SSdst1YfOjY3zsbapyOl3YHXElpfjv31Hk58WEPysXs CL7DpQY2bc0/3SZyz3QKj6vCHp7es8dklZM9EwKGR/+BahbnBkyvT1jO4RCSg97G470R wM6hfASU3yoTcHp5GvGnrDLV8NWEkjUNAlzO1Xy6AFM+IX7yeGbspl3SH30QVWxHJx8X PDow== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si868607ejh.334.2020.04.20.10.02.49; Mon, 20 Apr 2020 10:03:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726055AbgDTRBr (ORCPT + 99 others); Mon, 20 Apr 2020 13:01:47 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:50135 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725784AbgDTRBr (ORCPT ); Mon, 20 Apr 2020 13:01:47 -0400 Received: from callcc.thunk.org (pool-100-0-195-244.bstnma.fios.verizon.net [100.0.195.244]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 03KH1WTK016582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Apr 2020 13:01:33 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id CF88242013B; Mon, 20 Apr 2020 13:01:31 -0400 (EDT) Date: Mon, 20 Apr 2020 13:01:31 -0400 From: "Theodore Y. Ts'o" To: Peter Maydell Cc: Eric Blake , Linus Walleij , Linux API , QEMU Developers , Florian Weimer , Andreas Dilger , Andy Lutomirski , linux-fsdevel , Ext4 Developers List Subject: Re: [PATCH] fcntl: Add 32bit filesystem mode Message-ID: <20200420170131.GD1080594@mit.edu> References: <20200331133536.3328-1-linus.walleij@linaro.org> <20200420151344.GC1080594@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Apr 20, 2020 at 04:29:32PM +0100, Peter Maydell wrote: > On Mon, 20 Apr 2020 at 16:24, Eric Blake wrote: > > 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. > > For instance, a quick grep shows 4 instances of this in QEMU :-) Fortunately, most applications aren't going to be interested in forcing 32-bit mode for 64-bit applications, QEMU being the notable exception. We do need to make sure that for 32-bit applications, we either make FD_32BIT_MODE a no-op (don't set the bit, and ignore the bit). We could allow the bit to be visible for 32-bit applications, but we would want to disallow clearing the the bit for 32-bit applications if it was visible. If we did that, then blind assignments of fcntl(fd, F_SETFD, 1) should be mostly harmless with respect to the FD_32BIT_MODE bit. - Ted