From patchwork Mon Mar 23 13:54:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 46197 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F407B20D10 for ; Mon, 23 Mar 2015 13:58:38 +0000 (UTC) Received: by labgq15 with SMTP id gq15sf27397047lab.0 for ; Mon, 23 Mar 2015 06:58:37 -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=bpCsUQZyNImnDBkBzr7hN0Jwjl5+T9EGnGrQqKp63ms=; b=mJjG29qiNUQaMC3PtmnaDchoYa3+EVFRyCGRpd6lwbqMgdvfMs6T2kWibkjVq7aapa T8ztaDC0Y6ByL4D9p4KTgcqEuJhiII4eLHT/o6KJiPGsPpACSpAq1l6A/VRmtDKG4zMf Ib2TQULIFCSlk8vahwBSZjIxAgJlAenWxnEhQkrA99vaP7ZxKz6YYxQhbojkt6P0o6by S+O2ahCpup+G6rLNFs6552fSxiD5Esb/GEU8Jqbff1B09a7ACsRsNdIVsjqc1mJ94sBB qyk0YPf8iPKUJVARGAjEc9738HOOIqnYXLVumes8BFz9f4SKxPC0mo/8su/511tUkFB6 ZIkQ== X-Gm-Message-State: ALoCoQkozLtu9R/G1C/ONx4VMxzmzjkx+OCYbpaNeoLMbppxCMcXET5D4xRITG9NvMpdYHJfm/v7 X-Received: by 10.112.130.70 with SMTP id oc6mr15987592lbb.13.1427119117728; Mon, 23 Mar 2015 06:58:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.65 with SMTP id b1ls699837laf.99.gmail; Mon, 23 Mar 2015 06:58:37 -0700 (PDT) X-Received: by 10.153.5.37 with SMTP id cj5mr2460485lad.14.1427119117513; Mon, 23 Mar 2015 06:58:37 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id f8si615110lam.159.2015.03.23.06.58.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 06:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbcgn8 with SMTP id gn8so118773251lbc.2 for ; Mon, 23 Mar 2015 06:58:37 -0700 (PDT) X-Received: by 10.112.130.100 with SMTP id od4mr61432524lbb.86.1427119117408; Mon, 23 Mar 2015 06:58:37 -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.112.57.201 with SMTP id k9csp843726lbq; Mon, 23 Mar 2015 06:58:36 -0700 (PDT) X-Received: by 10.55.55.85 with SMTP id e82mr142006018qka.2.1427119116079; Mon, 23 Mar 2015 06:58:36 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 92si744783qkq.75.2015.03.23.06.58.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 23 Mar 2015 06:58:36 -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]:56111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya2sF-000803-8O for patch@linaro.org; Mon, 23 Mar 2015 09:58:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya2pW-0004Hq-Fq for qemu-devel@nongnu.org; Mon, 23 Mar 2015 09:55:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ya2pP-000131-Tq for qemu-devel@nongnu.org; Mon, 23 Mar 2015 09:55:46 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:34404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya2pP-00012Z-Nj for qemu-devel@nongnu.org; Mon, 23 Mar 2015 09:55:39 -0400 Received: by lbbsy1 with SMTP id sy1so118883597lbb.1 for ; Mon, 23 Mar 2015 06:55:38 -0700 (PDT) X-Received: by 10.152.198.8 with SMTP id iy8mr65331336lac.13.1427118938832; Mon, 23 Mar 2015 06:55:38 -0700 (PDT) Received: from localhost.localdomain (91-157-196-38.elisa-laajakaista.fi. [91.157.196.38]) by mx.google.com with ESMTPSA id j6sm204311laf.5.2015.03.23.06.55.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Mar 2015 06:55:38 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 23 Mar 2015 15:54:54 +0200 Message-Id: <17644b362746c400f45b0d2b0a3ce8a52fed13fb.1427118794.git.riku.voipio@linaro.org> 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] [fuzzy] X-Received-From: 209.85.217.178 Cc: Andreas Schwab Subject: [Qemu-devel] [PULL 2/3] linux-user: fix emulation of splice syscall 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.217.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: Andreas Schwab The second and fourth argument are in/out parameters, store them back after the syscall. Also, the fourth argument was mishandled, and EFAULT handling was missing. Signed-off-by: Andreas Schwab Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5720195..4bd9543 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9351,15 +9351,29 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { loff_t loff_in, loff_out; loff_t *ploff_in = NULL, *ploff_out = NULL; - if(arg2) { - get_user_u64(loff_in, arg2); + if (arg2) { + if (get_user_u64(loff_in, arg2)) { + goto efault; + } ploff_in = &loff_in; } - if(arg4) { - get_user_u64(loff_out, arg2); + if (arg4) { + if (get_user_u64(loff_out, arg4)) { + goto efault; + } ploff_out = &loff_out; } ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5, arg6)); + if (arg2) { + if (put_user_u64(loff_in, arg2)) { + goto efault; + } + } + if (arg4) { + if (put_user_u64(loff_out, arg4)) { + goto efault; + } + } } break; #endif