From patchwork Tue Aug 19 08:32:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35564 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f71.google.com (mail-oi0-f71.google.com [209.85.218.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B6D82136C for ; Tue, 19 Aug 2014 08:42:09 +0000 (UTC) Received: by mail-oi0-f71.google.com with SMTP id e131sf35950605oig.6 for ; Tue, 19 Aug 2014 01:42:08 -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=eQUluqrF7FdOHR97n76QjT02rc9/DRfRPUy/npLKfBQ=; b=LX60y4XDoyqhP7w8kCnEWRBbkm2uA46SFFsaf59UQxvD4aucrXsdxnktZhhwmaiO6l xA9A8wUcdf/uQUnwkJVDy2/t+FeDxV3V65SVKEuSamI7/RZ5WbacaMj/IJVTw1kR+gYy 2XeiG4aWVE8VY1jBxBKemEPfIsCs9X8sKM4YTZ2+Me3xNGfoRjcDkdrLKa+C5UZRjDaC eS4VjmSRrTInGn6Xyu1bcBnMkMIW6RQmkWyRm9iyKt3bBZIKGBbXcgJnwP3OzIdCYWmI r1H95RCT+TWqj0yfsEu7Yk3DVla5zuQg20d9Y/TVuDumX/HH3pZGSQ67QGI9JON1WKhI JVXg== X-Gm-Message-State: ALoCoQmkudC5sJtNVR6EclLdsobxS938xn5EZHoj2RyUaqklfyKv2FkrbXBd7FOIzHWfOAT1+KZT X-Received: by 10.42.26.12 with SMTP id d12mr21380169icc.24.1408437728763; Tue, 19 Aug 2014 01:42:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.228 with SMTP id d91ls2764016qge.41.gmail; Tue, 19 Aug 2014 01:42:08 -0700 (PDT) X-Received: by 10.220.200.71 with SMTP id ev7mr29064893vcb.24.1408437728687; Tue, 19 Aug 2014 01:42:08 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id wk17si8355042vcb.9.2014.08.19.01.42.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so7128566vcb.3 for ; Tue, 19 Aug 2014 01:42:08 -0700 (PDT) X-Received: by 10.221.6.201 with SMTP id ol9mr29198052vcb.2.1408437728627; Tue, 19 Aug 2014 01:42:08 -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 tc5csp220717vcb; Tue, 19 Aug 2014 01:42:08 -0700 (PDT) X-Received: by 10.229.242.65 with SMTP id lh1mr64719194qcb.18.1408437727873; Tue, 19 Aug 2014 01:42:07 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q6si28031259qai.19.2014.08.19.01.42.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:42:07 -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]:49139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJezX-0007NA-1m for patch@linaro.org; Tue, 19 Aug 2014 04:42:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJequ-00012R-1n for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJeql-0001a7-Ns for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:11 -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-II 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 36B9126686; Tue, 19 Aug 2014 10:33:02 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 11:32:51 +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: Tom Musta Subject: [Qemu-devel] [PULL v2 16/23] 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.172 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 d223cff..a0436da 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7806,6 +7806,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); @@ -7817,6 +7820,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)) @@ -7830,6 +7837,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);