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

Re: [Xen-devel] [PATCH] [v2] xen: hypercall: fix out-of-bounds memcpy



On Mon, Feb 5, 2018 at 4:14 PM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>>> On 05.02.18 at 16:03, <arnd@xxxxxxxx> wrote:
>>  int xen_event_channel_op_compat(int cmd, void *arg)
>>  {
>> -     struct evtchn_op op;
>> +     struct evtchn_op op = { .cmd = cmd, };
>> +     size_t len;
>>       int rc;
>>
>> -     op.cmd = cmd;
>> -     memcpy(&op.u, arg, sizeof(op.u));
>> -     rc = _hypercall1(int, event_channel_op_compat, &op);
>> -
>> -     switch (cmd) {
>> -     case EVTCHNOP_close:
>> -     case EVTCHNOP_send:
>> -     case EVTCHNOP_bind_vcpu:
>> -     case EVTCHNOP_unmask:
>> -             /* no output */
>> -             break;
>> +     if (cmd > ARRAY_SIZE(evtchnop_len))
>> +             return -ENOSYS;
>
>>= perhaps?

Argh, of course. This is why I preferred the switch/case version, I knew
I'd screw this up somehow ;-)

       Arnd

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.