qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode


From: Eric Blake
Subject: Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode
Date: Mon, 12 Oct 2020 19:08:55 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]