[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC v2 07/16] vfio-user: get device info
|
From: |
Stefan Hajnoczi |
|
Subject: |
Re: [PATCH RFC v2 07/16] vfio-user: get device info |
|
Date: |
Tue, 24 Aug 2021 17:04:13 +0100 |
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.
Stefan
signature.asc
Description: PGP signature
- [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
- Re: [PATCH RFC v2 07/16] vfio-user: get device info,
Stefan Hajnoczi <=
- [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