From patchwork Fri Aug 22 13:24:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35814 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3587205D8 for ; Fri, 22 Aug 2014 13:35:21 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id r5sf32564818qcx.1 for ; Fri, 22 Aug 2014 06:35:21 -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=FTNFdxkYsVIja9A51iJz7GJ/0ymo3Egw8F5hIB3bzvg=; b=MjmvRz15O6XxT6OKEAsGYlfBcaN78RdXE+TKsv7A86tw55IckNRl3aJYEmED0VlP7U nmgeeQs3K/f7Tn7RyGjkvP8lNW05LdWWcy25mu620I5p60BiEjpiNVcj7l9hX8KhDHfi t0AgKr7WCSUT8/z+J6Bl2zeQt5Rq79HtGVlaAjBeFqnDuP/a+VPwDZUE6Ka1UjFbQsLG zbd9Zbtzn25iklofpBZw2tMFONlh56acymwlcqspybXFsJYfC9tP34e2klO/1QO+mmkJ i7E4IEfL6tOfx0y6g4ZNeGdzCNgfMAgemfJeVwuip+tYFFc8k1EMWesNWYdchh1Sddh8 HD2g== X-Gm-Message-State: ALoCoQlxUbdkadclZnzfjYZv0g0PGyTQkpZiOCenREzSvvS6W592p4ppJDBnb2yzykh+rZjmMy9c X-Received: by 10.236.191.37 with SMTP id f25mr30210440yhn.44.1408714521604; Fri, 22 Aug 2014 06:35:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.119 with SMTP id f110ls1026819qga.96.gmail; Fri, 22 Aug 2014 06:35:21 -0700 (PDT) X-Received: by 10.52.121.74 with SMTP id li10mr3351639vdb.19.1408714521435; Fri, 22 Aug 2014 06:35:21 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id qu14si13573439vdb.23.2014.08.22.06.35.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Aug 2014 06:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so12006383vcb.8 for ; Fri, 22 Aug 2014 06:35:21 -0700 (PDT) X-Received: by 10.52.165.116 with SMTP id yx20mr986003vdb.13.1408714521350; Fri, 22 Aug 2014 06:35:21 -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 uj3csp17365vcb; Fri, 22 Aug 2014 06:35:20 -0700 (PDT) X-Received: by 10.140.107.198 with SMTP id h64mr7346364qgf.42.1408714519661; Fri, 22 Aug 2014 06:35:19 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t48si42272267qge.30.2014.08.22.06.35.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 Aug 2014 06:35:19 -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]:37163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKozv-0003nj-5w for patch@linaro.org; Fri, 22 Aug 2014 09:35:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKopo-0006X7-EH for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:25:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKoph-0002Ca-3Z for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:24:52 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=54479 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKopg-0002Bm-Td for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:24:45 -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 270042658D; Fri, 22 Aug 2014 15:24:43 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 22 Aug 2014 16:24:33 +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: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Tom Musta Subject: [Qemu-devel] [PULL v3 15/22] linux-user: Handle NULL sched_param argument to sched_* 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.177 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 The sched_getparam, sched_setparam and sched_setscheduler system calls take a pointer argument to a sched_param structure. When this pointer is null, errno should be set to EINVAL. Signed-off-by: Tom Musta Signed-off-by: Riku Voipio --- linux-user/syscall.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2549249..4424b63 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7736,6 +7736,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, struct sched_param *target_schp; struct sched_param schp; + if (arg2 == 0) { + return -TARGET_EINVAL; + } if (!lock_user_struct(VERIFY_READ, target_schp, arg2, 1)) goto efault; schp.sched_priority = tswap32(target_schp->sched_priority); @@ -7747,6 +7750,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct sched_param *target_schp; struct sched_param schp; + + if (arg2 == 0) { + return -TARGET_EINVAL; + } ret = get_errno(sched_getparam(arg1, &schp)); if (!is_error(ret)) { if (!lock_user_struct(VERIFY_WRITE, target_schp, arg2, 0)) @@ -7760,6 +7767,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct sched_param *target_schp; struct sched_param schp; + if (arg3 == 0) { + return -TARGET_EINVAL; + } if (!lock_user_struct(VERIFY_READ, target_schp, arg3, 1)) goto efault; schp.sched_priority = tswap32(target_schp->sched_priority);