From patchwork Tue Aug 19 08:32:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35555 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A9A392136C for ; Tue, 19 Aug 2014 08:37:30 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf49424455pdb.9 for ; Tue, 19 Aug 2014 01:37:24 -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=HyXd6lQlgDvAzz+qhj1qemhdHmoNJVKgAzEVHRsTZSE=; b=G4vsE69hXLZv0tP64rpXHmULes4PfLXxld0D3fNggMPHjeAem5snzu+1f5XiUfBopp ehJZqtzuQgA1rLLzh1GNO7DhQqCB8BN0yxN1wVXPo1Z5Chu8lnZ1pv4EYNKCIS/fMl98 VlsU9r9NQR0z0AqRL+4ha/75HRYO0Iwc53RDmPN0IEtYjnKuvDdk/SSr79B5xfsLRK21 aN++9vsqOwMRWdyzDpxzFJoEF7ITD5AbhqQ+b+adXYgCv3fhmJR9+25XCKVIyClMjGKf E26V+Zh/XKPe7PZCxM8um3sUm2dffNoHg2MDuGux89VOtbKmcAMWRHosdYGYp4DnMP5z enkw== X-Gm-Message-State: ALoCoQkcZW7WSQ3uRaGEkw3yIZILT2yM3BsjpnmQPfT9jzyvkc97wXxn0ofo4YO7P8Qyf1P3o8RF X-Received: by 10.66.249.73 with SMTP id ys9mr21774080pac.9.1408437442437; Tue, 19 Aug 2014 01:37:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.148 with SMTP id 20ls2747414qgt.86.gmail; Tue, 19 Aug 2014 01:37:22 -0700 (PDT) X-Received: by 10.220.247.3 with SMTP id ma3mr26527015vcb.29.1408437442324; Tue, 19 Aug 2014 01:37:22 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id ur3si8348318vcb.43.2014.08.19.01.37.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:37:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id hq11so7068126vcb.16 for ; Tue, 19 Aug 2014 01:37:22 -0700 (PDT) X-Received: by 10.52.160.10 with SMTP id xg10mr1055651vdb.1.1408437442222; Tue, 19 Aug 2014 01:37:22 -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.37.5 with SMTP id tc5csp220380vcb; Tue, 19 Aug 2014 01:37:21 -0700 (PDT) X-Received: by 10.229.68.131 with SMTP id v3mr64737342qci.10.1408437441249; Tue, 19 Aug 2014 01:37:21 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s78si28038869qgd.19.2014.08.19.01.37.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:37:21 -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]:49099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeuu-0007NS-OK for patch@linaro.org; Tue, 19 Aug 2014 04:37:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeqq-0000wZ-Km for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJeql-0001ZF-Dc for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:08 -0400 Received: from afflict.kos.to ([92.243.29.197]:35150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeql-0001YP-7O for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:03 -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 E537E265F1; Tue, 19 Aug 2014 10:33:01 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 11:32:46 +0300 Message-Id: <43ca049bf7664bdc88898f980bd2bad1fcfe74ac.1408436940.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: Tom Musta Subject: [Qemu-devel] [PULL v2 11/23] 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.171 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 239e682..0113250 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));