lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACycT3sLjx1b9BjijP0ofM6OZkgRHk92VunGQcAweguBPzN1Dg@mail.gmail.com>
Date: Wed, 10 Jan 2024 11:27:50 +0800
From: Yongji Xie <xieyongji@...edance.com>
To: Maxime Coquelin <maxime.coquelin@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>, 
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, 
	virtualization <virtualization@...ts.linux-foundation.org>, 
	linux-kernel <linux-kernel@...r.kernel.org>, David Marchand <david.marchand@...hat.com>, 
	Cindy Lu <lulu@...hat.com>, Eugenio Pérez <eperezma@...hat.com>
Subject: Re: [PATCH v7 3/3] vduse: enable Virtio-net device type

On Tue, Jan 9, 2024 at 7:10 PM Maxime Coquelin
<maxime.coquelin@...hat.com> wrote:
>
> This patch adds Virtio-net device type to the supported
> devices types.
>
> Initialization fails if the device does not support
> VIRTIO_F_VERSION_1 feature, in order to guarantee the
> configuration space is read-only. It also fails with
> -EPERM if the CAP_NET_ADMIN is missing.
>
> Acked-by: Jason Wang <jasowang@...hat.com>
> Reviewed-by: Eugenio Pérez <eperezma@...hat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@...hat.com>

Reviewed-by: Xie Yongji <xieyongji@...edance.com>

Thanks,
Yongji

> ---
>  drivers/vdpa/vdpa_user/vduse_dev.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 00f3f562ab5d..8924bbc55635 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -143,6 +143,7 @@ static struct workqueue_struct *vduse_irq_bound_wq;
>
>  static u32 allowed_device_id[] = {
>         VIRTIO_ID_BLOCK,
> +       VIRTIO_ID_NET,
>  };
>
>  static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa)
> @@ -1686,6 +1687,10 @@ static bool features_is_valid(struct vduse_dev_config *config)
>                         (config->features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)))
>                 return false;
>
> +       if ((config->device_id == VIRTIO_ID_NET) &&
> +                       !(config->features & BIT_ULL(VIRTIO_F_VERSION_1)))
> +               return false;
> +
>         return true;
>  }
>
> @@ -1793,6 +1798,10 @@ static int vduse_create_dev(struct vduse_dev_config *config,
>         int ret;
>         struct vduse_dev *dev;
>
> +       ret = -EPERM;
> +       if ((config->device_id == VIRTIO_ID_NET) && !capable(CAP_NET_ADMIN))
> +               goto err;
> +
>         ret = -EEXIST;
>         if (vduse_find_dev(config->name))
>                 goto err;
> @@ -2036,6 +2045,7 @@ static const struct vdpa_mgmtdev_ops vdpa_dev_mgmtdev_ops = {
>
>  static struct virtio_device_id id_table[] = {
>         { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID },
> +       { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID },
>         { 0 },
>  };
>
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ