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

2020-04-21 Thread Peter Maydell
On Tue, 21 Apr 2020 at 00:51, Andreas Dilger wrote: > Another question I had here is whether the filesystem needs to provide > 32-bit values for other syscalls, such as stat() and statfs()? For > ext4, stat() is not going to return a 64-bit inode number, but other > filesystems might (e.g. Lustre

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

2020-04-20 Thread Andreas Dilger
> From 73471e01733dd1d998ff3cd41edebb4c78793193 Mon Sep 17 00:00:00 2001 > From: Peter Maydell > Date: Mon, 20 Apr 2020 11:54:22 +0100 > Subject: [RFC] linux-user: Use new F_SET_FILE_32BIT_FS fcntl for 32-bit guests > > If the guest is 32 bit then there is a potential problem if the > host gives

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

2020-04-20 Thread Theodore Y. Ts'o
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

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

2020-04-20 Thread Peter Maydell
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 prote

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

2020-04-20 Thread Eric Blake
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

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

2020-04-20 Thread Theodore Y. Ts'o
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 underl

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

2020-04-20 Thread Peter Maydell
On Mon, 20 Apr 2020 at 12:38, Peter Maydell wrote: > Whoops, good point. I was testing this via lkvm, so it's > actually using a 9p filesystem... I'll see if I can figure > out how to test with an ext3 fs, which I think is the one > we most care about. After some effort wrestling with kvmtool (wh

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

2020-04-20 Thread Peter Maydell
On Mon, 20 Apr 2020 at 12:23, Florian Weimer wrote: > > * Peter Maydell: > > > We open fd 3 to read '.'; we issue the new fcntl, which > > succeeds. Then there's some unrelated stuff operating on > > stdout. Then we do a getdents64(), but the d_off values > > we get back are still 64 bits. The gue

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

2020-04-20 Thread Florian Weimer
* Peter Maydell: > We open fd 3 to read '.'; we issue the new fcntl, which > succeeds. Then there's some unrelated stuff operating on > stdout. Then we do a getdents64(), but the d_off values > we get back are still 64 bits. The guest binary doesn't > like those, so it fails. My expectation was th

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

2020-04-20 Thread Peter Maydell
On Tue, 31 Mar 2020 at 14:37, 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 files

[PATCH] fcntl: Add 32bit filesystem mode

2020-03-31 Thread Linus Walleij
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 6