From patchwork Tue Jul 19 12:54:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 72311 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp69576qga; Tue, 19 Jul 2016 06:06:47 -0700 (PDT) X-Received: by 10.37.204.7 with SMTP id l7mr5592303ybf.137.1468933607232; Tue, 19 Jul 2016 06:06:47 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v64si11155809qkd.281.2016.07.19.06.06.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Jul 2016 06:06:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUjW-0002w0-Mj for patch@linaro.org; Tue, 19 Jul 2016 09:06:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUXe-0007Om-Qe for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPUXc-0003Nv-Po for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:29 -0400 Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]:33661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUXc-0003Nf-I9 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:28 -0400 Received: by mail-lf0-x22d.google.com with SMTP id b199so13472406lfe.0 for ; Tue, 19 Jul 2016 05:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bHpxMThVVqv0rCaVf6roZ0fn98BqQLpMJZVmUEbGY/Q=; b=ISCEjZ5R38WX2U+XT5drHCeDHpmH8IED1LYOpuBJ0eeRQm8/xQUWnjhg5RopTemYhi uEaDvaOrar2imQw9N6W6XSllouA24UN+L2LYVPZ1v4WL4z9xPbbO61k+m76LfIpqPf+d ciyQCHWRp7eTDs7snHYDALIrlKJr5GWEaieug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bHpxMThVVqv0rCaVf6roZ0fn98BqQLpMJZVmUEbGY/Q=; b=UFziqpufijnjdI3V4wx2JHMculzYpXwlqU8nUvseiPtJFeQpZskwuYISg4ZKEEnrKd GEStRRlqUuF5RTXRRnxyhRDgwJD97V6quJzQd48nThSNgdyxNVq+mwzZcNLZfmOR9sjL 7i67mBi0zPKGw78eka6CaImh7XRqFsK50Wxykrlafw51OOmNzJNBlYhT0dp897aAiFVw 0xAkEDq9XY7nU6uMaXyhey0DE004s3KnhIqSDYCOG9eSIXl0nxrLI057jHgsUEtpCFyS DvBETS8vD7i8WXSiGDQ0BERqUZo9dZKWGnlkIehsN0KRD44dZv5XfHDG+8Jq6dHNilFL 8w+g== X-Gm-Message-State: ALyK8tJWbUEW+mRbHn3lu3cmFn1LupBRFjttKhA0npyYFyGjFMEwGvZm4IaxILHRYvnYAFy8 X-Received: by 10.25.77.15 with SMTP id a15mr18148690lfb.179.1468932867747; Tue, 19 Jul 2016 05:54:27 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id g3sm2248898lfe.14.2016.07.19.05.54.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 05:54:27 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 19 Jul 2016 15:54:07 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22d Subject: [Qemu-devel] [PULL 09/16] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Reviewed-by: Laurent Vivier Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/ioctls.h | 4 ++-- linux-user/syscall_types.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) -- 2.1.4 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 */