[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH 07/12] linux-user: Handle NULL argume
From: |
Peter Maydell |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH 07/12] linux-user: Handle NULL argument to sched_{get, set}param |
Date: |
Mon, 4 Aug 2014 18:32:22 +0100 |
On 4 August 2014 17:45, Tom Musta <address@hidden> wrote:
> The sched_getparam and sched_setparam system calls take a pointer
> argument to a sched_param structure. When this pointer is null,
> errno should be set to EINVAL.
Don't we also need this for the other syscall which takes a
sched_param pointer, sched_setscheduler?
(Strictly speaking I think we could get away without the check
in sched_getparam, because the host syscall will return EINVAL
for us, but I'm happy for us to put the explicit check in for
consistency.)
>
> Signed-off-by: Tom Musta <address@hidden>
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index f524a39..5f193cd 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -7699,6 +7699,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);
> @@ -7710,6 +7713,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))
> --
> 1.7.1
thanks
-- PMM
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/12] linux-user: Dereference Pointer Argument to ipc/semctl Sys Call, (continued)
- [Qemu-ppc] [PATCH 03/12] linux-user: Properly Handle semun Structure In Cross-Endian Situations, Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 04/12] linux-user: Make ipc syscall's third argument an abi_long, Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 05/12] linux-user: Conditionally Pass Attribute Pointer to mq_open(), Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 06/12] linux-user: Detect Negative Message Sizes in msgsnd System Call, Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 07/12] linux-user: Handle NULL argument to sched_{get, set}param, Tom Musta, 2014/08/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 07/12] linux-user: Handle NULL argument to sched_{get, set}param,
Peter Maydell <=
- [Qemu-ppc] [PATCH 08/12] linux-user: Detect fault in sched_rr_get_interval, Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 09/12] linux-user: Minimum Sig Handler Stack Size for PPC64 ELF V2, Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 10/12] linux-user: clock_nanosleep errno Handling on PPC, Tom Musta, 2014/08/04
- [Qemu-ppc] [PATCH 11/12] linux-user: Support target-to-host translation of mlockall argument, Tom Musta, 2014/08/04