[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e395753a-115c-57d1-4312-b28e5f0d6ebf@redhat.com>
Date: Mon, 12 Oct 2020 19:08:55 -0500
From: Eric Blake <eblake@...hat.com>
To: Linus Walleij <linus.walleij@...aro.org>,
Theodore Ts'o <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>
Cc: Peter Maydell <peter.maydell@...aro.org>,
linux-api@...r.kernel.org, qemu-devel@...gnu.org,
Florian Weimer <fw@...eb.enyo.de>,
Andy Lutomirski <luto@...nel.org>,
linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode
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
Powered by blists - more mailing lists