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]
Date: Thu,  4 Jan 2024 16:37:52 +0100
From: Maxime Coquelin <maxime.coquelin@...hat.com>
To: mst@...hat.com,
	jasowang@...hat.com,
	xuanzhuo@...ux.alibaba.com,
	xieyongji@...edance.com,
	virtualization@...ts.linux-foundation.org,
	linux-kernel@...r.kernel.org,
	david.marchand@...hat.com,
	lulu@...hat.com
Cc: Maxime Coquelin <maxime.coquelin@...hat.com>
Subject: [PATCH v6 2/3] vduse: Temporarily fail if control queue features requested

Virtio-net driver control queue implementation is not safe
when used with VDUSE. If the VDUSE application does not
reply to control queue messages, it currently ends up
hanging the kernel thread sending this command.

Some work is on-going to make the control queue
implementation robust with VDUSE. Until it is completed,
let's fail features check if any control-queue related
feature is requested.

Signed-off-by: Maxime Coquelin <maxime.coquelin@...hat.com>
---
 drivers/vdpa/vdpa_user/vduse_dev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 0486ff672408..94f54ea2eb06 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -28,6 +28,7 @@
 #include <uapi/linux/virtio_config.h>
 #include <uapi/linux/virtio_ids.h>
 #include <uapi/linux/virtio_blk.h>
+#include <uapi/linux/virtio_ring.h>
 #include <linux/mod_devicetable.h>
 
 #include "iova_domain.h"
@@ -46,6 +47,15 @@
 
 #define IRQ_UNBOUND -1
 
+#define VDUSE_NET_INVALID_FEATURES_MASK         \
+	(BIT_ULL(VIRTIO_NET_F_CTRL_VQ) |        \
+	 BIT_ULL(VIRTIO_NET_F_CTRL_RX)   |      \
+	 BIT_ULL(VIRTIO_NET_F_CTRL_VLAN) |      \
+	 BIT_ULL(VIRTIO_NET_F_GUEST_ANNOUNCE) | \
+	 BIT_ULL(VIRTIO_NET_F_MQ) |             \
+	 BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) |  \
+	 BIT_ULL(VIRTIO_NET_F_RSS))
+
 struct vduse_virtqueue {
 	u16 index;
 	u16 num_max;
@@ -1680,6 +1690,9 @@ static bool features_is_valid(struct vduse_dev_config *config)
 	if ((config->device_id == VIRTIO_ID_BLOCK) &&
 			(config->features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE)))
 		return false;
+	else if ((config->device_id == VIRTIO_ID_NET) &&
+			(config->features & VDUSE_NET_INVALID_FEATURES_MASK))
+		return false;
 
 	return true;
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ