[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/16] linux-user: Correct type for LOOP_GET_STATUS{,
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 09/16] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls |
Date: |
Tue, 19 Jul 2016 15:54:07 +0300 |
From: Peter Maydell <address@hidden>
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 <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
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 a066d9b..33ede9c 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -322,9 +322,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 */
--
2.1.4
- [Qemu-devel] [PULL 03/16] linux-user: add fd_trans helper in do_recvfrom(), (continued)
- [Qemu-devel] [PULL 03/16] linux-user: add fd_trans helper in do_recvfrom(), riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 01/16] linux-user: fd_trans_*_data() returns the length, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 04/16] linux-user: convert sockaddr_ll from host to target, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 02/16] linux-user: fix netlink memory corruption, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 06/16] linux-user: Check sigsetsize argument to syscalls, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 07/16] linux-user: Add loop control ioctls, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 08/16] linux-user: Correct type for BLKSSZGET, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 10/16] linux-user: Forget about synchronous signal once it is delivered, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 05/16] linux-user: add nested netlink types, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 11/16] linux-user: Handle short lengths in host_to_target_sockaddr(), riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 09/16] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls,
riku . voipio <=
- [Qemu-devel] [PULL 12/16] linux-user: Add some new blk ioctls, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 13/16] TIOCGPTN and related terminal control ioctls were not converted to the guest ioctl format on x86_64 targets. Convert these ioctls to enable terminal functionality on x86_64 guests., riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 15/16] linux-user: Fix type for SIOCATMARK ioctl, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 14/16] linux-user: define missing sparc syscalls, riku . voipio, 2016/07/19
- [Qemu-devel] [PULL 16/16] linux-user: AArch64 has sync_file_range, not sync_file_range2, riku . voipio, 2016/07/19