From patchwork Mon Jun 23 13:26:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 32350 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D65420540 for ; Mon, 23 Jun 2014 13:28:02 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf23093556obc.1 for ; Mon, 23 Jun 2014 06:28:02 -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=rkicVtrxvL34xJZs4HraYFpiv6tI6aSbq7vraKjGmmY=; b=bqT7hKNx5Cx4EXGx48XoyyPGv+xEgeHHsuyxr/2u3gy9aP3kyRezXmsT7cB2StJ15J E3z4kjnfozcfdHjF0U8L0eWfKE+oz8R3nD91rRxnT/Zy8yI7zZI5Y9TkZtLobvBu+MMB iAM+pEierb3qIb+mojj2F7ZhPZ62Ms5hf99GzoVdvUYoVZblL9efOGXHDYTcLv1n/Mfa bcDCJxDNrIhvq88vqXZWpcAxzNlkjUlzEWwDdxkF3b4PY0rQwh2VD3KI/KFWEC1+MtUN cxbj+GHN/uYA1GmWdVR3l6nwUd4/ykzWz8i4iCZIBxw/sAHSX0k8JMGQRlbmlxB2vUn8 C+gA== X-Gm-Message-State: ALoCoQkeJT0BUZsnNrSie4pOukkPoazbfpLVSwM3FKMevZtUaoT+Qg+c9rah0+Eja3DAP4Rg2N0x X-Received: by 10.43.134.65 with SMTP id ib1mr7231924icc.21.1403530081827; Mon, 23 Jun 2014 06:28:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.6 with SMTP id t6ls804132qga.51.gmail; Mon, 23 Jun 2014 06:28:01 -0700 (PDT) X-Received: by 10.58.117.232 with SMTP id kh8mr271590veb.81.1403530081749; Mon, 23 Jun 2014 06:28:01 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id cy16si8990053veb.16.2014.06.23.06.28.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:28:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jx11so6094049veb.19 for ; Mon, 23 Jun 2014 06:28:01 -0700 (PDT) X-Received: by 10.58.209.7 with SMTP id mi7mr271118vec.80.1403530081690; Mon, 23 Jun 2014 06:28:01 -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 tc5csp130632vcb; Mon, 23 Jun 2014 06:28:01 -0700 (PDT) X-Received: by 10.224.79.11 with SMTP id n11mr17410201qak.40.1403530081121; Mon, 23 Jun 2014 06:28:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id bt6si9858352qcb.16.2014.06.23.06.28.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:28:01 -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]:53494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz4Hw-0004ys-4U for patch@linaro.org; Mon, 23 Jun 2014 09:28:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz4Gm-0003iK-JF for qemu-devel@nongnu.org; Mon, 23 Jun 2014 09:26:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz4Gd-0001BF-KF for qemu-devel@nongnu.org; Mon, 23 Jun 2014 09:26:48 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=37368 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz4Gd-0001Ab-Cm for qemu-devel@nongnu.org; Mon, 23 Jun 2014 09:26:39 -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 77E8B2658D; Mon, 23 Jun 2014 15:26:36 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 23 Jun 2014 16:26:27 +0300 Message-Id: <4bbae3dfad7a937b1051f648f207a34c69c9c7d7.1403529800.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: Paul Burton Subject: [Qemu-devel] [PULL 12/19] linux-user: allow NULL tv argument for settimeofday 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.128.174 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: Paul Burton The tv argument to the settimeofday syscall is allowed to be NULL, if the program only wishes to provide the timezone. QEMU previously returned -EFAULT when tv was NULL. Instead, execute the syscall & provide NULL to the kernel as the target program expected. Signed-off-by: Paul Burton Signed-off-by: Riku Voipio --- linux-user/syscall.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 0ce1a4e..8e2762b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6401,11 +6401,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_NR_settimeofday: { - struct timeval tv; + struct timeval tv, *ptv = NULL; struct timezone tz, *ptz = NULL; - if (copy_from_user_timeval(&tv, arg1)) - goto efault; + if (arg1) { + if (copy_from_user_timeval(&tv, arg1)) { + goto efault; + } + ptv = &tv; + } if (arg2) { if (copy_from_user_timezone(&tz, arg2)) { @@ -6414,7 +6418,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ptz = &tz; } - ret = get_errno(settimeofday(&tv, ptz)); + ret = get_errno(settimeofday(ptv, ptz)); } break; #if defined(TARGET_NR_select)