From patchwork Fri Aug 15 11:01:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35430 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 80353203C5 for ; Fri, 15 Aug 2014 11:03:20 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf17527917pab.8 for ; Fri, 15 Aug 2014 04:03:14 -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=Iui0T5tkm1RlLSeZpYCoyEuAVXNU9ZWcnjIlKsJMeOWBGlbjLkzpQ6zKALYVRza+hP Gn/dZNrJiLp8MG5TJAMP10ONeTfJKJZUCx4968TyI9HWA+br+REe8Xad+zaSGyEP8iW5 dTlGvhlNr1+gzMRkmH38qoJZzUCd9sGrFwFHZw7mt/nNwqQSkAO1bpyri8TfqxWolxH5 fgr0OM3K4iJdtkCSYilebhsZ57H13wfUPaKUbIbYTvSwhAgKT5Qd7eXz4PoEZ2doCvMV h9nkIYKY61HAJOKwma8NCndT82fXtEKunwzZEGgQmd3t+v6YVWaZOO4rK1kZFNSZgpa2 I9nQ== X-Gm-Message-State: ALoCoQkPZfzX6mvGBk2Ln7wxnNazT88xrPhiB7SBBxuDxk07+Rdr++xUDA0b2MsK6yzkzPtTHM2k X-Received: by 10.66.163.41 with SMTP id yf9mr8905867pab.36.1408100592603; Fri, 15 Aug 2014 04:03:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.35.197 with SMTP id n63ls1420891qgn.35.gmail; Fri, 15 Aug 2014 04:03:12 -0700 (PDT) X-Received: by 10.140.108.200 with SMTP id j66mr25403894qgf.43.1408100592490; Fri, 15 Aug 2014 04:03:12 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id 107si11330470qgh.70.2014.08.15.04.03.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so2708546vcb.26 for ; Fri, 15 Aug 2014 04:03:12 -0700 (PDT) X-Received: by 10.220.167.9 with SMTP id o9mr9784232vcy.8.1408100592294; Fri, 15 Aug 2014 04:03:12 -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 tc5csp103976vcb; Fri, 15 Aug 2014 04:03:11 -0700 (PDT) X-Received: by 10.140.94.100 with SMTP id f91mr24863370qge.41.1408100591543; Fri, 15 Aug 2014 04:03:11 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n20si11325699qar.74.2014.08.15.04.03.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:03:11 -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]:58535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFHr-0006Cc-2u for patch@linaro.org; Fri, 15 Aug 2014 07:03:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGc-0004x9-IM for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:02:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIFGU-00072i-Vv for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:54 -0400 Received: from afflict.kos.to ([92.243.29.197]:57589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGU-00071I-QH 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 2E69026686; Fri, 15 Aug 2014 13:01:45 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 15 Aug 2014 14:01:35 +0300 Message-Id: <603ae192a8a6497aaf0e8883dc0949c507582f09.1408100160.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: 92.243.29.197 Cc: Peter Maydell , Tom Musta Subject: [Qemu-devel] [PULL 17/24] 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.181 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);