From patchwork Tue Jul 19 12:54:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 650186 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rv0qC4wFcz9t0H for ; Tue, 19 Jul 2016 23:13:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=gto1aWmu; dkim-atps=neutral Received: from localhost ([::1]:55797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUqD-0008H5-HI for incoming@patchwork.ozlabs.org; Tue, 19 Jul 2016 09:13:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUXe-0007Ny-2j 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 1bPUXb-0003NX-QX for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:29 -0400 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]:34433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUXb-0003NN-JO for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:27 -0400 Received: by mail-lf0-x229.google.com with SMTP id l69so13411604lfg.1 for ; Tue, 19 Jul 2016 05:54:27 -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=aq8Bj25V4mbshvYsZr1RZGaOtRXJt4QRpPBUpTT6HBQ=; b=gto1aWmutKUST5ktA36zmKSfXl9/BrBy5FMkcPoTeFFQm+anuQjEUetr79aLvdVhUl aU8nyZq0fbi5QB29gmhkO8BCcya/G/yRgrKPxqx2rPwk4T0SpC4zO5zApiTneKkjUX4G UWWtfaLQ411Rw2P0DDKoOkHd5t8hiPVLK4ne0= 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=aq8Bj25V4mbshvYsZr1RZGaOtRXJt4QRpPBUpTT6HBQ=; b=iJ6vy5hGu1HbKavMITynw9o+958k1ArPIFn8DCMdDPJk4u1OM6v4FKTw00y+FY3aP6 L1+HYixvnulaAuWka8jIhmP2G4/pPkCyOwTvkNzDIWM3dyutK5oUwXa4YRIEarTqdYiZ lj9LUil+GVXruZAsjxQlMUhIDrklttJXaPvdybPuAxCGo4gT5iiap3B/tDPfjsWcWTg0 r9feNnI+U9vjXno1XnNtoNreBGwh4vJ8lr4RdjFWE15Ki6twp6LuDGbyFGqVWRUDByc9 XQXKzC1IwgsCO6d3dSEllKIsEJW/Q6EiV/JaviDpFmZMstGQuRyFTTTUdfrdOt4mt3NH RjZA== X-Gm-Message-State: ALyK8tIXd1JXRbaqA1TBRkoK4qQmsM1eh/IwCG+Zjc9IL7jCP/8/jVCInVNqqyMbP1AxeaQg X-Received: by 10.46.0.220 with SMTP id e89mr17278152lji.58.1468932866538; Tue, 19 Jul 2016 05:54:26 -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.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 05:54:25 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 19 Jul 2016 15:54:06 +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::229 Subject: [Qemu-devel] [PULL 08/16] linux-user: Correct type for BLKSSZGET 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Reviewed-by: Laurent Vivier Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- 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 abff6b6..a066d9b 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)))