From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHHDx-0004Qt-8t for qemu-devel@nongnu.org; Tue, 12 Aug 2014 14:55:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHHDo-0007FW-0k for qemu-devel@nongnu.org; Tue, 12 Aug 2014 14:55:09 -0400 From: Tom Musta Date: Tue, 12 Aug 2014 13:53:38 -0500 Message-Id: <1407869623-11185-8-git-send-email-tommusta@gmail.com> In-Reply-To: <1407869623-11185-1-git-send-email-tommusta@gmail.com> References: <1407869623-11185-1-git-send-email-tommusta@gmail.com> Subject: [Qemu-devel] [V2 PATCH 07/12] 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: peter.maydell@linaro.org, riku.voipio@linaro.org, agraf@suse.de, 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 --- 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