From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHdrw-0005Q7-FX for qemu-devel@nongnu.org; Wed, 13 Aug 2014 15:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHdrl-0004CF-6V for qemu-devel@nongnu.org; Wed, 13 Aug 2014 15:05:56 -0400 From: Tom Musta Date: Wed, 13 Aug 2014 14:04:42 -0500 Message-Id: <1407956688-16006-8-git-send-email-tommusta@gmail.com> In-Reply-To: <1407956688-16006-1-git-send-email-tommusta@gmail.com> References: <1407956688-16006-1-git-send-email-tommusta@gmail.com> Subject: [Qemu-devel] [V3 PATCH 07/13] linux-user: Handle NULL sched_param argument to sched_* List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Tom Musta , riku.voipio@linaro.org, agraf@suse.de 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 --- V2: Including sched_setscheduler in the changes per Peter Maydell's review. linux-user/syscall.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 79fb3cb..49b8a07 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7702,6 +7702,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); @@ -7713,6 +7716,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)) @@ -7726,6 +7733,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); -- 1.7.1