From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSyn-0001Qy-Lv for qemu-devel@nongnu.org; Tue, 05 Jul 2016 12:13:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSyk-0000nq-F7 for qemu-devel@nongnu.org; Tue, 05 Jul 2016 12:13:45 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:52359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSyk-0000nm-4K for qemu-devel@nongnu.org; Tue, 05 Jul 2016 12:13:42 -0400 References: <1467732989-12028-1-git-send-email-peter.maydell@linaro.org> From: Laurent Vivier Message-ID: <578f0bff-bee2-8d60-b9a5-115cf8a5319f@vivier.eu> Date: Tue, 5 Jul 2016 18:13:25 +0200 MIME-Version: 1.0 In-Reply-To: <1467732989-12028-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: patches@linaro.org, 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 > Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier > --- > 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 */ >