* [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls
@ 2016-07-05 15:36 Peter Maydell
2016-07-05 16:13 ` Laurent Vivier
2016-07-07 6:27 ` Chanho Park
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2016-07-05 15:36 UTC (permalink / raw)
To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Chanho Park, Chanho Park
The LOOP_GET_STATUS and LOOP_GET_STATUS64 ioctls were incorrectly
defined as IOC_W rather than IOC_R, which meant we weren't
correctly copying the information back from the kernel to the guest.
The loop_info64 structure definition was also missing a member
and using the wrong type for several 32-bit fields.
In particular, this meant that "kpartx -d image.img" didn't work
and "losetup -a" behaved strangely. Correct the ioctl type definitions.
Reported-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is intended to be applied on top of the other ioctl patches I've
sent out recently.
linux-user/ioctls.h | 4 ++--
linux-user/syscall_types.h | 9 +++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 8978eb3..4b36baa 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -351,9 +351,9 @@
IOCTL(LOOP_SET_FD, 0, TYPE_INT)
IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
- IOCTL(LOOP_GET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
+ IOCTL(LOOP_GET_STATUS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
- IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
+ IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)
IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 1fd4ee0..af79fbf 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -103,10 +103,11 @@ STRUCT(loop_info64,
TYPE_ULONGLONG, /* lo_inode */
TYPE_ULONGLONG, /* lo_rdevice */
TYPE_ULONGLONG, /* lo_offset */
- TYPE_ULONG, /* lo_number */
- TYPE_ULONG, /* lo_encrypt_type */
- TYPE_ULONG, /* lo_encrypt_key_size */
- TYPE_ULONG, /* lo_flags */
+ TYPE_ULONGLONG, /* lo_sizelimit */
+ TYPE_INT, /* lo_number */
+ TYPE_INT, /* lo_encrypt_type */
+ TYPE_INT, /* lo_encrypt_key_size */
+ TYPE_INT, /* lo_flags */
MK_ARRAY(TYPE_CHAR, 64), /* lo_name */
MK_ARRAY(TYPE_CHAR, 64), /* lo_crypt_name */
MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls
2016-07-05 15:36 [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls Peter Maydell
@ 2016-07-05 16:13 ` Laurent Vivier
2016-07-07 6:27 ` Chanho Park
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2016-07-05 16:13 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Chanho Park, Chanho Park
Le 05/07/2016 à 17:36, Peter Maydell a écrit :
> The LOOP_GET_STATUS and LOOP_GET_STATUS64 ioctls were incorrectly
> defined as IOC_W rather than IOC_R, which meant we weren't
> correctly copying the information back from the kernel to the guest.
> The loop_info64 structure definition was also missing a member
> and using the wrong type for several 32-bit fields.
>
> In particular, this meant that "kpartx -d image.img" didn't work
> and "losetup -a" behaved strangely. Correct the ioctl type definitions.
>
> Reported-by: Chanho Park <chanho61.park@samsung.com>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
> This is intended to be applied on top of the other ioctl patches I've
> sent out recently.
>
> linux-user/ioctls.h | 4 ++--
> linux-user/syscall_types.h | 9 +++++----
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 8978eb3..4b36baa 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -351,9 +351,9 @@
> IOCTL(LOOP_SET_FD, 0, TYPE_INT)
> IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
> IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
> - IOCTL(LOOP_GET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
> + IOCTL(LOOP_GET_STATUS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
> IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
> - IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
> + IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
> IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)
>
> IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index 1fd4ee0..af79fbf 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -103,10 +103,11 @@ STRUCT(loop_info64,
> TYPE_ULONGLONG, /* lo_inode */
> TYPE_ULONGLONG, /* lo_rdevice */
> TYPE_ULONGLONG, /* lo_offset */
> - TYPE_ULONG, /* lo_number */
> - TYPE_ULONG, /* lo_encrypt_type */
> - TYPE_ULONG, /* lo_encrypt_key_size */
> - TYPE_ULONG, /* lo_flags */
> + TYPE_ULONGLONG, /* lo_sizelimit */
> + TYPE_INT, /* lo_number */
> + TYPE_INT, /* lo_encrypt_type */
> + TYPE_INT, /* lo_encrypt_key_size */
> + TYPE_INT, /* lo_flags */
> MK_ARRAY(TYPE_CHAR, 64), /* lo_name */
> MK_ARRAY(TYPE_CHAR, 64), /* lo_crypt_name */
> MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls
2016-07-05 15:36 [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls Peter Maydell
2016-07-05 16:13 ` Laurent Vivier
@ 2016-07-07 6:27 ` Chanho Park
1 sibling, 0 replies; 3+ messages in thread
From: Chanho Park @ 2016-07-07 6:27 UTC (permalink / raw)
To: Peter Maydell
Cc: qemu-devel, patches, Riku Voipio, Laurent Vivier, Chanho Park
Hi Peter,
On Wednesday, July 6, 2016, Peter Maydell <peter.maydell@linaro.org> wrote:
> The LOOP_GET_STATUS and LOOP_GET_STATUS64 ioctls were incorrectly
> defined as IOC_W rather than IOC_R, which meant we weren't
> correctly copying the information back from the kernel to the guest.
> The loop_info64 structure definition was also missing a member
> and using the wrong type for several 32-bit fields.
>
> In particular, this meant that "kpartx -d image.img" didn't work
> and "losetup -a" behaved strangely. Correct the ioctl type definitions.
>
> Reported-by: Chanho Park <chanho61.park@samsung.com <javascript:;>>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org <javascript:;>>
> ---
It worked well for me.
Tested-by: Chanho Park <parkch98@gmail.com>
>
--
Best Regards,
Chanho Park
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-07 6:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-05 15:36 [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls Peter Maydell
2016-07-05 16:13 ` Laurent Vivier
2016-07-07 6:27 ` Chanho Park
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.