The FIGETBSZ ioctl get's "int *" (pointer to 32bit integer) as argument,
not "long *" as specified in qemu. Using the correct type makes the
emulation work.
Signed-off-by: Bastian Blank <waldi@debian.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185
---
linux-user/ioctls.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 3b41128..c87ce61 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -145,7 +145,7 @@
IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
#endif
- IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
+ IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_INT))
#ifdef CONFIG_FIEMAP
IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
MK_PTR(MK_STRUCT(STRUCT_fiemap)))
--
2.51.0
On Tue, 28 Oct 2025 at 11:29, Bastian Blank <waldi@debian.org> wrote: > > The FIGETBSZ ioctl get's "int *" (pointer to 32bit integer) as argument, > not "long *" as specified in qemu. Using the correct type makes the > emulation work. We could also note: This ioctl does not seem to be documented. However the kernel implementation has always used "int *". thanks -- PMM
On 10/28/25 14:29, Bastian Blank wrote: > The FIGETBSZ ioctl get's "int *" (pointer to 32bit integer) as argument, > not "long *" as specified in qemu. Using the correct type makes the > emulation work. > > Signed-off-by: Bastian Blank <waldi@debian.org> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185 Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> (Adding Laurent to Cc:) While applying, it'd be nice to include "linux-user: " prefix to the subject. And the thing should definitely be picked up for the stable series (Cc'd). This bug has been with us since the day linux-user was implemented, in 2003. I can pick this one up to qemu-trivial tree, if no one objects. Thanks, /mjt > linux-user/ioctls.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h > index 3b41128..c87ce61 100644 > --- a/linux-user/ioctls.h > +++ b/linux-user/ioctls.h > @@ -145,7 +145,7 @@ > IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range))) > #endif > > - IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG)) > + IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_INT)) > #ifdef CONFIG_FIEMAP > IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap, > MK_PTR(MK_STRUCT(STRUCT_fiemap)))
On 10/28/25 12:29, Bastian Blank wrote: > The FIGETBSZ ioctl get's "int *" (pointer to 32bit integer) as argument, > not "long *" as specified in qemu. Using the correct type makes the > emulation work. > > Signed-off-by: Bastian Blank <waldi@debian.org> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185 > --- > linux-user/ioctls.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h > index 3b41128..c87ce61 100644 > --- a/linux-user/ioctls.h > +++ b/linux-user/ioctls.h > @@ -145,7 +145,7 @@ > IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range))) > #endif > > - IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG)) > + IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_INT)) Looks good. Reviewed-by: Helge Deller <deller@gmx.de> Can you check FIBMAP as well? I think it needs the same patch... Helge
On Tue, Oct 28, 2025 at 12:35:35PM +0100, Helge Deller wrote: > Can you check FIBMAP as well? I think it needs the same patch... You are right, it does need the same. However that is now untested from my side. Bastian -- We do not colonize. We conquer. We rule. There is no other way for us. -- Rojan, "By Any Other Name", stardate 4657.5
© 2016 - 2025 Red Hat, Inc.