qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 07/13] linux-user: Fix sched_get/setaffinity conv


From: Samuel Thibault
Subject: Re: [Qemu-devel] [PULL 07/13] linux-user: Fix sched_get/setaffinity conversion
Date: Fri, 26 Jan 2018 19:33:56 +0100
User-agent: NeoMutt/20170113 (1.7.2)

Peter Maydell, on ven. 26 janv. 2018 18:23:02 +0000, wrote:
> On 23 January 2018 at 14:48, Laurent Vivier <address@hidden> wrote:
> > From: Samuel Thibault <address@hidden>
> >
> > sched_get/setaffinity linux-user syscalls were missing conversions for
> > little/big endian, which is hairy since longs may not be the same size
> > either.
> >
> > For simplicity, this just introduces loops to convert bit by bit like is
> > done for select.
> >
> > Signed-off-by: Samuel Thibault <address@hidden>
> > Reviewed-by: Laurent Vivier <address@hidden>
> > Message-Id: <address@hidden>
> > Signed-off-by: Laurent Vivier <address@hidden>
> > ---
> 
> > @@ -10395,9 +10463,7 @@ abi_long do_syscall(void *cpu_env, int num, 
> > abi_long arg1,
> >                      ret = arg2;
> >                  }
> >
> > -                if (copy_to_user(arg3, mask, ret)) {
> > -                    goto efault;
> > -                }
> > +                ret = host_to_target_cpu_mask(mask, mask_size, arg3, arg2);
> >              }
> >          }
> >          break;
> 
> Hi -- Coverity spots that in this change, we now have a case
> where we set "ret = arg2;" which then immediately is replaced
> by "ret = host_to_target_cpu_mask(mask, mask_size, arg3, arg2);",
> making the first assignment pointless.
> 
> It looks like we're now ignoring the host filled buffer size
> that is returned by sys_sched_getaffinity() and then adjusted
> by this bit of code. Shouldn't we be using that value in this
> new host_to_target_cpu_mask() code?

Indeed, will send a patch against this.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]