From: Eric Blake <eblake@redhat.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Peter Maydell <peter.maydell@linaro.org>,
linux-api@vger.kernel.org, qemu-devel@nongnu.org,
Florian Weimer <fw@deneb.enyo.de>,
Andy Lutomirski <luto@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode
Date: Mon, 12 Oct 2020 19:08:55 -0500 [thread overview]
Message-ID: <e395753a-115c-57d1-4312-b28e5f0d6ebf@redhat.com> (raw)
In-Reply-To: <20201012220620.124408-1-linus.walleij@linaro.org>
On 10/12/20 5:06 PM, 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 flag to the fcntl() F_GETFD and F_SETFD operations
> to set the underlying filesystem into 32bit mode even if the
> file handle was opened using 64bit mode without the compat
> syscalls.
>
> Programs that need the 32 bit file system behavior need to
> issue a fcntl() system call such as in this example:
>
> #define FD_32BIT_MODE 2
>
> int main(int argc, char** argv) {
> DIR* dir;
> int err;
> int fd;
>
> dir = opendir("/boot");
> fd = dirfd(dir);
> err = fcntl(fd, F_SETFD, FD_32BIT_MODE);
This is a blind set, and wipes out FD_CLOEXEC. Better would be to do a
proper demonstration of the read-modify-write with F_GETFD that portable
programs will have to use in practice.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-10-13 0:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 22:06 [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode Linus Walleij
2020-10-13 0:08 ` Eric Blake [this message]
2020-10-13 9:22 ` Dave Martin
2020-11-17 23:38 ` Linus Walleij
2020-11-18 9:00 ` Arnd Bergmann
2021-11-15 10:56 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e395753a-115c-57d1-4312-b28e5f0d6ebf@redhat.com \
--to=eblake@redhat.com \
--cc=adilger.kernel@dilger.ca \
--cc=fw@deneb.enyo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).