Received: from eggs.gnu.org ([2001:4830:134:3::10]:56879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK6O8-0007G6-9V for qemu-devel@nongnu.org; Mon, 04 Jul 2016 12:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK6O6-0001wE-7W for qemu-devel@nongnu.org; Mon, 04 Jul 2016 12:06:23 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:58081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK6O5-0001vx-Vf for qemu-devel@nongnu.org; Mon, 04 Jul 2016 12:06:22 -0400 From: Peter Maydell Date: Mon, 4 Jul 2016 17:06:18 +0100 Message-Id: <1467648378-26630-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1467648378-26630-1-git-send-email-peter.maydell@linaro.org> References: <1467648378-26630-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 2/2] linux-user: Correct type for BLKSSZGET List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Chanho Park , Chanho Park The BLKSSZGET ioctl takes an argument which is a pointer to an int. We were incorrectly declaring it to take a pointer to a long, which meant that we would incorrectly write to memory which we should not if the guest is a 64-bit architecture. In particular, kpartx uses this ioctl to write to an int on the stack, which tends to result in it crashing immediately. Reported-by: Chanho Park Signed-off-by: Peter Maydell --- linux-user/ioctls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index 72cd32a..8978eb3 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -76,7 +76,7 @@ IOCTL(BLKFLSBUF, 0, TYPE_NULL) IOCTL(BLKRASET, 0, TYPE_INT) IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG)) - IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_LONG)) + IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_INT)) IOCTL(BLKBSZGET, IOC_R, MK_PTR(TYPE_INT)) IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg, MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg))) -- 1.9.1