qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/4] qemu-user: Impl. setsockopt(SO_BINDTODEVICE


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 1/4] qemu-user: Impl. setsockopt(SO_BINDTODEVICE)
Date: Sat, 12 Jul 2014 10:01:55 +0100

On 12 July 2014 09:31, Joakim Tjernlund <address@hidden> wrote:
> Peter Maydell <address@hidden> wrote on 2014/07/11 19:02:30:
>> I thought about that, but there's a corner case:
>> the kernel does the clamping of the optlen before the
>> copy_from_user(), which means if you have:
>>  [interface name] [unreadable memory]
>> and optlen is long enough that optval_addr + optlen
>> reaches into the unreadable memory, then QEMU will return
>> EFAULT (whereas the native kernel implementation will
>> succeed) unless we do the clamping of the optlen ourselves.
>
> I can live with that IMHO very minor flaw that I dont think is
> going to matter in practice for simplicity and speed of QEMU.
> It is your call though, do we go for exact emulation or can we
> cut some corners?

In this case I would prefer to get it right:
 * it's purely localised to this function
 * it's not all that hard to get right
 * we've already done the hard work of looking at the
   kernel and determining the correct behaviour

SO_BINDTODEVICE is not going to be on any guest's
speed-critical fastpath anyway...

thanks
-- PMM



reply via email to

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