[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC v2 07/16] vfio-user: get device info
|
From: |
John Johnson |
|
Subject: |
Re: [PATCH RFC v2 07/16] vfio-user: get device info |
|
Date: |
Mon, 30 Aug 2021 03:11:39 +0000 |
> On Aug 24, 2021, at 9:04 AM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Mon, Aug 16, 2021 at 09:42:40AM -0700, Elena Ufimtseva wrote:
>> +int vfio_user_get_info(VFIODevice *vbasedev)
>> +{
>> + VFIOUserDeviceInfo msg;
>> +
>> + memset(&msg, 0, sizeof(msg));
>> + vfio_user_request_msg(&msg.hdr, VFIO_USER_DEVICE_GET_INFO, sizeof(msg),
>> 0);
>> + msg.argsz = sizeof(struct vfio_device_info);
>> +
>> + vfio_user_send_recv(vbasedev->proxy, &msg.hdr, NULL, 0, 0);
>> + if (msg.hdr.flags & VFIO_USER_ERROR) {
>> + return -msg.hdr.error_reply;
>> + }
>> +
>> + vbasedev->num_irqs = msg.num_irqs;
>> + vbasedev->num_regions = msg.num_regions;
>> + vbasedev->flags = msg.flags;
>> + vbasedev->reset_works = !!(msg.flags & VFIO_DEVICE_FLAGS_RESET);
>
> No input validation. I haven't checked what happens when num_irqs,
> num_regions, or flags are bogus but it's a little concerning. Unlike
> kernel VFIO, we do not trust these values.
>
As in the last reply, vfio-user doesn’t know valid values
from invalid, so I need to re-work this so the PCI-specific code that
calls vfio-user_get_info() can test for invalid values.
JJ
- [PATCH RFC v2 00/16] vfio-user implementation, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 04/16] vfio-user: connect vfio proxy to remote server, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 03/16] vfio-user: Define type vfio_user_pci_dev_info, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 07/16] vfio-user: get device info, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 06/16] vfio-user: negotiate version with remote server, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 05/16] vfio-user: define VFIO Proxy and communication functions, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 08/16] vfio-user: get region info, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 02/16] vfio-user: add VFIO base abstract class, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 10/16] vfio-user: pci_user_realize PCI setup, Elena Ufimtseva, 2021/08/16
- [PATCH RFC v2 11/16] vfio-user: get and set IRQs, Elena Ufimtseva, 2021/08/16