From patchwork Fri Aug 15 11:01:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35435 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07150203C5 for ; Fri, 15 Aug 2014 11:07:18 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id h136sf11599537oig.8 for ; Fri, 15 Aug 2014 04:07:18 -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=inPfdRd69hQwP7X1llaJuA3e9VlcMblezThpE4YTKAPqowUliOUrOfbJTDqHxxUml8 niQiMsic/VGA2k/N0T6qRBIwUu1obs5WDWAhaR4l2pB0YV4ENT9Cp/KWUQ3xoDqMmfv1 FJDptsGDZzeIiXf0EZDtuWm8kHBuY7ZKPYbgDzC52DJmE/zP/uVtdhuhwipBRZWmD7h9 BBogg1zMFwU6/xCGq4xrDDfu4SV95pP/NsXhoFAW5Ba3TDhY9EKY+LL+h1dTql+wdyIM XAIfI7hEYqzYOYe5Gf72GvsMcKsaTRbOBWHnczOxC4tc7ZQM5MvRNlruT0aZYpGUWBE8 Yziw== X-Gm-Message-State: ALoCoQlalM4EAR32FNW7PsI4iEEZQ4h4UOgV/Wdm/clIfwBwtNQYS3i4atfk1hZl/05/5lh6hOJy X-Received: by 10.42.235.132 with SMTP id kg4mr9730345icb.22.1408100838592; Fri, 15 Aug 2014 04:07:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.6 with SMTP id s6ls1372241qgd.22.gmail; Fri, 15 Aug 2014 04:07:18 -0700 (PDT) X-Received: by 10.224.46.8 with SMTP id h8mr26910089qaf.6.1408100838510; Fri, 15 Aug 2014 04:07:18 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id a31si11332621qgf.100.2014.08.15.04.07.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so2717799vcb.24 for ; Fri, 15 Aug 2014 04:07:18 -0700 (PDT) X-Received: by 10.52.164.199 with SMTP id ys7mr3733687vdb.42.1408100838245; Fri, 15 Aug 2014 04:07:18 -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 tc5csp104268vcb; Fri, 15 Aug 2014 04:07:17 -0700 (PDT) X-Received: by 10.140.17.79 with SMTP id 73mr23581280qgc.47.1408100837557; Fri, 15 Aug 2014 04:07:17 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o1si6702377qce.33.2014.08.15.04.07.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:07:17 -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]:58575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFLp-0004qm-0p for patch@linaro.org; Fri, 15 Aug 2014 07:07:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGf-0004xI-HT for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:02:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIFGV-00072z-0w for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:57 -0400 Received: from afflict.kos.to ([92.243.29.197]:57601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGU-00071l-QJ for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:46 -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 E1322265F1; Fri, 15 Aug 2014 13:01:44 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 15 Aug 2014 14:01:30 +0300 Message-Id: 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 , Tom Musta Subject: [Qemu-devel] [PULL 12/24] 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.179 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));