qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation
@ 2025-10-28 12:16 Bastian Blank
  2025-10-28 13:11 ` Peter Maydell
  2025-10-28 13:55 ` Michael Tokarev
  0 siblings, 2 replies; 5+ messages in thread
From: Bastian Blank @ 2025-10-28 12:16 UTC (permalink / raw)
  To: qemu-devel

Both the FIBMAP and FIGETBSZ ioctl get "int *" (pointer to 32bit
integer) as argument, not "long *" as specified in qemu.  Using the
correct type makes the emulation work in cross endian context.

Both ioctl does not seem to be documented. However the kernel
implementation has always used "int *".

Signed-off-by: Bastian Blank <waldi@debian.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185
---
 linux-user/ioctls.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 3b41128..2f62fd2 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -130,7 +130,7 @@
      IOCTL(FDTWADDLE, 0, TYPE_NULL)
      IOCTL(FDEJECT, 0, TYPE_NULL)
 
-     IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
+     IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_INT))
 #ifdef FICLONE
      IOCTL(FICLONE, IOC_W, TYPE_INT)
      IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation
  2025-10-28 12:16 [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation Bastian Blank
@ 2025-10-28 13:11 ` Peter Maydell
  2025-10-28 13:47   ` Helge Deller
  2025-10-28 13:55 ` Michael Tokarev
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2025-10-28 13:11 UTC (permalink / raw)
  To: Bastian Blank, qemu-devel

On Tue, 28 Oct 2025 at 12:58, Bastian Blank <bblank@thinkmo.de> wrote:
>
> Both the FIBMAP and FIGETBSZ ioctl get "int *" (pointer to 32bit
> integer) as argument, not "long *" as specified in qemu.  Using the
> correct type makes the emulation work in cross endian context.
>
> Both ioctl does not seem to be documented. However the kernel
> implementation has always used "int *".
>
> Signed-off-by: Bastian Blank <waldi@debian.org>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation
  2025-10-28 13:11 ` Peter Maydell
@ 2025-10-28 13:47   ` Helge Deller
  0 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2025-10-28 13:47 UTC (permalink / raw)
  To: Peter Maydell, Bastian Blank, qemu-devel

On 10/28/25 14:11, Peter Maydell wrote:
> On Tue, 28 Oct 2025 at 12:58, Bastian Blank <bblank@thinkmo.de> wrote:
>>
>> Both the FIBMAP and FIGETBSZ ioctl get "int *" (pointer to 32bit
>> integer) as argument, not "long *" as specified in qemu.  Using the
>> correct type makes the emulation work in cross endian context.
>>
>> Both ioctl does not seem to be documented. However the kernel
>> implementation has always used "int *".
>>
>> Signed-off-by: Bastian Blank <waldi@debian.org>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185
>> ---
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Helge Deller <deller@gmx.de>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation
  2025-10-28 12:16 [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation Bastian Blank
  2025-10-28 13:11 ` Peter Maydell
@ 2025-10-28 13:55 ` Michael Tokarev
  2025-10-29  7:43   ` Richard Henderson
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2025-10-28 13:55 UTC (permalink / raw)
  To: Bastian Blank, qemu-devel; +Cc: Laurent Vivier, qemu-stable

On 10/28/25 15:16, Bastian Blank wrote:
> Both the FIBMAP and FIGETBSZ ioctl get "int *" (pointer to 32bit
> integer) as argument, not "long *" as specified in qemu.  Using the
> correct type makes the emulation work in cross endian context.
> 
> Both ioctl does not seem to be documented. However the kernel
> implementation has always used "int *".
> 
> Signed-off-by: Bastian Blank <waldi@debian.org>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185

Reviwed-by: Michael Tokarev <mjt@tls.msk.ru>

Again, I can pick this up through qemu-trivial if there's no
objection, Laurent?

And Cc: qemu-stable.

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation
  2025-10-28 13:55 ` Michael Tokarev
@ 2025-10-29  7:43   ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2025-10-29  7:43 UTC (permalink / raw)
  To: qemu-devel

On 10/28/25 14:55, Michael Tokarev wrote:
> On 10/28/25 15:16, Bastian Blank wrote:
>> Both the FIBMAP and FIGETBSZ ioctl get "int *" (pointer to 32bit
>> integer) as argument, not "long *" as specified in qemu.  Using the
>> correct type makes the emulation work in cross endian context.
>>
>> Both ioctl does not seem to be documented. However the kernel
>> implementation has always used "int *".
>>
>> Signed-off-by: Bastian Blank <waldi@debian.org>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3185
> 
> Reviwed-by: Michael Tokarev <mjt@tls.msk.ru>
> 
> Again, I can pick this up through qemu-trivial if there's no
> objection, Laurent?

Please do.

r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-29  7:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 12:16 [PATCH v2] linux-user: Use correct type for FIBMAP and FIGETBSZ emulation Bastian Blank
2025-10-28 13:11 ` Peter Maydell
2025-10-28 13:47   ` Helge Deller
2025-10-28 13:55 ` Michael Tokarev
2025-10-29  7:43   ` Richard Henderson

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).