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>] [day] [month] [year] [list]
Message-ID: <20260128084559.256235-1-johannes.thumshirn@wdc.com>
Date: Wed, 28 Jan 2026 09:45:59 +0100
From: Johannes Thumshirn <johannes.thumshirn@....com>
To: virtualization@...ts.linux.dev
Cc: "Michael S . Tsirkin" <mst@...hat.com>,
	Jason Wang <jasowang@...hat.com>,
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
	Eugenio Pérez <eperezma@...hat.com>,
	Alexander Graf <graf@...zon.com>,
	linux-kernel@...r.kernel.org,
	Johannes Thumshirn <johannes.thumshirn@....com>,
	kernel test robot <lkp@...el.com>
Subject: [PATCH] virtio: fix compilation error in __vringh_notify_enable

Commit d43eaf1d749b ("virtio: silence KCSAN warning in
virtqueue_kick_prepare") introduced a compile error in
__vringh_notify_enable() because __vringh_notify_enable dereferences the
return of the vring_avail_event() macro making it incompatible with the
data_race() annotation added in d43eaf1d749b.

Remove the data_race() annotation in vring_avail_event() and move it
into it's callers instead.

Fixes: d43eaf1d749b ("virtio: silence KCSAN warning in virtqueue_kick_prepare")
Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601280148.8Z2rFqjo-lkp@intel.com/
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....com>
---

Michael: I wasn't sure if you want a patch on top (what I did) or a new
version of the broken patch to replace it. Just drop me a note if I
should take the other way.


 drivers/vhost/vringh.c           | 4 ++--
 drivers/virtio/virtio_ring.c     | 2 +-
 include/uapi/linux/virtio_ring.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 925858cc6096..47d3a8bb9c52 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -556,10 +556,10 @@ static inline bool __vringh_notify_enable(struct vringh *vrh,
 			return true;
 		}
 	} else {
-		if (putu16(vrh, &vring_avail_event(&vrh->vring),
+		if (putu16(vrh, data_race(&vring_avail_event(&vrh->vring)),
 			   vrh->last_avail_idx) != 0) {
 			vringh_bad("Updating avail event index %p",
-				   &vring_avail_event(&vrh->vring));
+				   data_race(&vring_avail_event(&vrh->vring)));
 			return true;
 		}
 	}
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1db27ee2d89f..95744d03b284 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -737,7 +737,7 @@ static bool virtqueue_kick_prepare_split(struct virtqueue *_vq)
 
 	if (vq->event) {
 		needs_kick = vring_need_event(virtio16_to_cpu(_vq->vdev,
-					vring_avail_event(&vq->split.vring)),
+					data_race(vring_avail_event(&vq->split.vring))),
 					      new, old);
 	} else {
 		needs_kick = !(vq->split.vring.used->flags &
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 32568cfa1c63..f8c20d3de8da 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -194,7 +194,7 @@ struct vring {
 /* We publish the used event index at the end of the available ring, and vice
  * versa. They are at the end for backwards compatibility. */
 #define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
-#define vring_avail_event(vr) (data_race(*(__virtio16 *)&(vr)->used->ring[(vr)->num]))
+#define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num])
 
 static inline void vring_init(struct vring *vr, unsigned int num, void *p,
 			      unsigned long align)
-- 
2.52.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ