From patchwork Fri Aug 22 13:24:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35804 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 68F2A20540 for ; Fri, 22 Aug 2014 13:30:18 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf82703383pdj.4 for ; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) 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=3zUTqH8LzDbOH5ARd2sXL1ajZP3IaEDp3jcJNgbu22A=; b=k2l/p+2+izB+QfECTP6EYKDh2W4N6NhJoHBLrZqsdYqi4FIL0TVWVoqwdmSM2QCqj0 gnr5KHio/PbXe3OlqgXI6EImKyWr7w4OLUYKmHuwc49sUBDnMG50EwTyeQF+4+CwBN+k AaLvoOV6ptj2ovjC6sjhqyN/HE8pBRBYpdn6hsDBUszFGidZfxQBnpcSRNPX6kdIgZ4t 3Hmfq/YCxloSKccNfs1/Qn0ujb9URZtLKWxVy/BLY8aYn0l7SRcbUEaQ72BjUtfHaKfI VnYs5afUZg7UpeHEE9H9n0E90DPdG+nMeTEH8eV2sWNthK35rmOFanpLDBOPHggTutnj xBcA== X-Gm-Message-State: ALoCoQnROA0X2ITtsAFDKtFFvxhKj4zcgG7a5BZzqeYl6a5N258hOHA7XCb490AHVpo2+5jcexCL X-Received: by 10.66.121.129 with SMTP id lk1mr1080365pab.16.1408714217716; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.148 with SMTP id 20ls1201910qgt.86.gmail; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) X-Received: by 10.52.253.39 with SMTP id zx7mr3428998vdc.2.1408714217598; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id fd7si13570504vdc.0.2014.08.22.06.30.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Aug 2014 06:30:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so12191295vcb.4 for ; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) X-Received: by 10.52.97.233 with SMTP id ed9mr959732vdb.16.1408714217488; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) 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.221.45.67 with SMTP id uj3csp17005vcb; Fri, 22 Aug 2014 06:30:17 -0700 (PDT) X-Received: by 10.224.79.139 with SMTP id p11mr5936386qak.93.1408714216753; Fri, 22 Aug 2014 06:30:16 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f89si42241398qgf.112.2014.08.22.06.30.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 Aug 2014 06:30:16 -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; Received: from localhost ([::1]:37105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKov2-0003HZ-C7 for patch@linaro.org; Fri, 22 Aug 2014 09:30:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKopn-0006WG-LT for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:24:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKopg-0002CE-VK for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:24:51 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=54467 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKopg-0002BM-Od for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:24:44 -0400 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 D49472657B; Fri, 22 Aug 2014 15:24:42 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 22 Aug 2014 16:24:28 +0300 Message-Id: <5d2fa8ebb4dae0057ed9baab617971dcd5ea493f.1408712881.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: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Tom Musta Subject: [Qemu-devel] [PULL v3 10/22] linux-user: Dereference Pointer Argument to ipc/semctl Sys Call 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.220.173 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: Tom Musta When the ipc system call is used to wrap a semctl system call, the ptr argument to ipc needs to be dereferenced prior to passing it to the semctl handler. This is because the fourth argument to semctl is a union and not a pointer to a union. Signed-off-by: Tom Musta Signed-off-by: Riku Voipio --- linux-user/syscall.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index fba7fd2..08fdd94 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3140,9 +3140,15 @@ static abi_long do_ipc(unsigned int call, int first, ret = get_errno(semget(first, second, third)); break; - case IPCOP_semctl: - ret = do_semctl(first, second, third, (union target_semun)(abi_ulong) ptr); + case IPCOP_semctl: { + /* The semun argument to semctl is passed by value, so dereference the + * ptr argument. */ + abi_ulong atptr; + get_user_ual(atptr, (abi_ulong)ptr); + ret = do_semctl(first, second, third, + (union target_semun)(abi_ulong) atptr); break; + } case IPCOP_msgget: ret = get_errno(msgget(first, second));