[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
- [Qemu-devel] [PULL 09/13] linux-user: Add getcpu() support, (continued)
- [Qemu-devel] [PULL 02/13] linux-user: wrap fork() in a start/end exclusive section, Laurent Vivier, 2018/01/23
- [Qemu-devel] [PULL 04/13] linux-user: Don't use CMSG_ALIGN(sizeof struct cmsghdr), Laurent Vivier, 2018/01/23
- [Qemu-devel] [PULL 07/13] linux-user: Fix sched_get/setaffinity conversion, Laurent Vivier, 2018/01/23
- [Qemu-devel] [PULL 11/13] linux-user: Propagate siginfo_t through to handle_cpu_signal(), Laurent Vivier, 2018/01/23
- [Qemu-devel] [PULL 12/13] page_unprotect(): handle calls to pages that are PAGE_WRITE, Laurent Vivier, 2018/01/23
- [Qemu-devel] [PULL 06/13] linux-user/mmap.c: Avoid choosing NULL as start address, Laurent Vivier, 2018/01/23
- Re: [Qemu-devel] [PULL 00/13] Linux user for 2.12 patches, Peter Maydell, 2018/01/25