On Tue, Jun 16, 2026 at 07:10:48PM +0200, Laurent Vivier wrote: > The function-local static buffers elem[] and iov_vu[] in > udp_vu_sock_to_tap() are shared across all threads. When multiple > worker threads process UDP vhost-user data concurrently, they would > stomp on each other's buffers. > > Remove the static qualifier so each call gets its own stack-allocated > arrays, eliminating cross-thread sharing. > > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson I generally dislike static locals anyway, though they have their uses. I'd be happy to see this applied independent of the rest of the series. > --- > udp_vu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/udp_vu.c b/udp_vu.c > index 864e7a99b8d9..342673dc7e6d 100644 > --- a/udp_vu.c > +++ b/udp_vu.c > @@ -146,8 +146,8 @@ void udp_vu_sock_to_tap(const struct ctx *c, int s, int n, flow_sidx_t tosidx, > { > const struct flowside *toside = flowside_at_sidx(tosidx); > bool v6 = !(inany_v4(&toside->eaddr) && inany_v4(&toside->oaddr)); > - static struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE]; > - static struct iovec iov_vu[VIRTQUEUE_MAX_SIZE]; > + struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE]; > + struct iovec iov_vu[VIRTQUEUE_MAX_SIZE]; Nit, this needs a little re-ordering to preserve the reverse christmas tree. > int rx_queue = QPAIR_TOGUEST_QUEUE(qpair); > struct vu_dev *vdev = c->vdev; > struct vu_virtq *vq = &vdev->vq[rx_queue]; > -- > 2.54.0 > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson