From patchwork Tue Jan 27 21:07:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 43863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC51723FFF for ; Tue, 27 Jan 2015 22:12:16 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf9083042lbj.0 for ; Tue, 27 Jan 2015 14:12:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Ik2xrH8j3lO/pRsFMLY27UlprWS/PgP01+tP1E+mzxg=; b=W5FBOwSr3uUEbOn7QS8weKjFR1v9uKSEblHuMaMrIFGMcgsL48OioYNiPdQNUlm2Mh 4p+smlyTowfNvTK723QR8kDu8riZqwn+JNIzHnFqH4bivKTk++F6XXv5P3bJNEHivFAT HDWCshPKD+CprojI/JFWUvWUMMC+WdaH9UaHKHXvtP6vRiU6cTsQGtur6cQ5kq/hv229 NUDrJ8zHnKa4NW6ZEQ3N2iHTTdde3OpzF5v8jIjTig1/qasfnU3Do2Z8V8ePtP3FcFMH TYS+8+7yXz11a0llVnC3P+HIkBeZxsyR2OWXoBWC3VdGKxVHvg1Rv5g6DcCfZVFVQwid Ka5Q== X-Gm-Message-State: ALoCoQkrE0QN7o0qqKqZJy/lK2A1Q2kQWDnqQdLR/kSjL7tgN00Ck/b4Ls87wKjXVMBcGm9RcTza X-Received: by 10.180.7.226 with SMTP id m2mr39078wia.5.1422396735806; Tue, 27 Jan 2015 14:12:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.49 with SMTP id o17ls96558laa.24.gmail; Tue, 27 Jan 2015 14:12:15 -0800 (PST) X-Received: by 10.112.160.193 with SMTP id xm1mr3673110lbb.5.1422396735617; Tue, 27 Jan 2015 14:12:15 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id dh5si2537570lad.33.2015.01.27.14.12.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 14:12:15 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id gm9so15912769lab.0 for ; Tue, 27 Jan 2015 14:12:15 -0800 (PST) X-Received: by 10.112.173.202 with SMTP id bm10mr4456461lbc.24.1422396735353; Tue, 27 Jan 2015 14:12:15 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1239814lbj; Tue, 27 Jan 2015 14:12:14 -0800 (PST) X-Received: by 10.224.161.81 with SMTP id q17mr6499774qax.34.1422396734015; Tue, 27 Jan 2015 14:12:14 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j8si3393518qas.27.2015.01.27.14.12.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 14:12:14 -0800 (PST) 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; Received: from localhost ([::1]:49954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDN0-0004tU-Fy for patch@linaro.org; Tue, 27 Jan 2015 16:08:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDMA-00047M-Bj for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGDM5-0005nJ-RO for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:30 -0500 Received: from afflict.kos.to ([92.243.29.197]:35447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDM5-0005mL-La for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:25 -0500 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 4BCAA264DC; Tue, 27 Jan 2015 22:07:23 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 27 Jan 2015 23:07:19 +0200 Message-Id: <9c6bf9c7d71d7da18a024182b69569969449d6f9.1422392096.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Ed Swierk Subject: [Qemu-devel] [PULL 08/11] linux-user: Fix ioctl cmd type mismatch on 64-bit targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Ed Swierk linux-user passes the cmd argument of the ioctl syscall as a signed long, but compares it to an unsigned int when iterating through the ioctl_entries list. When the cmd is a large value like 0x80047476 (TARGET_TIOCSWINSZ on mips64) it gets sign-extended to 0xffffffff80047476, causing the comparison to fail and resulting in lots of spurious "Unsupported ioctl" errors. Changing the target_cmd field in the ioctl_entries list to a signed int causes those values to be sign-extended as well during the comparison. Signed-off-by: Ed Swierk Signed-off-by: Riku Voipio --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5658b66..683f8cc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3278,7 +3278,7 @@ typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, abi_long cmd, abi_long arg); struct IOCTLEntry { - unsigned int target_cmd; + int target_cmd; unsigned int host_cmd; const char *name; int access;