On Fri, 2021-06-25 at 14:13 -0400, Willem de Bruijn wrote: > On Thu, Jun 24, 2021 at 8:30 AM David Woodhouse > wrote: > > > > From: David Woodhouse > > > > The vhost-net driver was making wild assumptions about the header > > length > > If respinning, please more concretely describe which configuration is > currently broken. Fairly much all of them. Here's a test run on the 5.12.8 kernel: $ sudo ./test_vhost_net TEST: (hdr 0, xdp 0, pi 0, features 0) RESULT: -1 TEST: (hdr 10, xdp 0, pi 0, features 0) RESULT: 0 TEST: (hdr 12, xdp 0, pi 0, features 0) RESULT: -1 TEST: (hdr 20, xdp 0, pi 0, features 0) RESULT: -1 TEST: (hdr 0, xdp 1, pi 0, features 0) RESULT: -1 TEST: (hdr 10, xdp 1, pi 0, features 0) RESULT: -1 TEST: (hdr 12, xdp 1, pi 0, features 0) RESULT: -1 TEST: (hdr 20, xdp 1, pi 0, features 0) RESULT: -1 TEST: (hdr 0, xdp 0, pi 1, features 0) RESULT: -1 TEST: (hdr 10, xdp 0, pi 1, features 0) RESULT: -1 TEST: (hdr 12, xdp 0, pi 1, features 0) RESULT: -1 TEST: (hdr 20, xdp 0, pi 1, features 0) RESULT: -1 TEST: (hdr 0, xdp 1, pi 1, features 0) RESULT: -1 TEST: (hdr 10, xdp 1, pi 1, features 0) RESULT: -1 TEST: (hdr 12, xdp 1, pi 1, features 0) RESULT: -1 TEST: (hdr 20, xdp 1, pi 1, features 0) RESULT: -1 TEST: (hdr 0, xdp 0, pi 0, features 100000000) RESULT: -1 TEST: (hdr 10, xdp 0, pi 0, features 100000000) RESULT: -1 TEST: (hdr 12, xdp 0, pi 0, features 100000000) RESULT: 0 TEST: (hdr 20, xdp 0, pi 0, features 100000000) RESULT: -1 TEST: (hdr 0, xdp 1, pi 0, features 100000000) RESULT: -1 TEST: (hdr 10, xdp 1, pi 0, features 100000000) RESULT: -1 TEST: (hdr 12, xdp 1, pi 0, features 100000000) RESULT: -1 TEST: (hdr 20, xdp 1, pi 0, features 100000000) RESULT: -1 TEST: (hdr 0, xdp 0, pi 1, features 100000000) RESULT: -1 TEST: (hdr 10, xdp 0, pi 1, features 100000000) RESULT: -1 TEST: (hdr 12, xdp 0, pi 1, features 100000000) RESULT: -1 TEST: (hdr 20, xdp 0, pi 1, features 100000000) RESULT: -1 TEST: (hdr 0, xdp 1, pi 1, features 100000000) RESULT: -1 TEST: (hdr 10, xdp 1, pi 1, features 100000000) RESULT: -1 TEST: (hdr 12, xdp 1, pi 1, features 100000000) RESULT: -1 TEST: (hdr 20, xdp 1, pi 1, features 100000000) RESULT: -1 TEST: (hdr 0, xdp 0, pi 0, features 8000000) RESULT: 0 TEST: (hdr 0, xdp 1, pi 0, features 8000000) RESULT: -1 TEST: (hdr 0, xdp 0, pi 1, features 8000000) RESULT: -1 TEST: (hdr 0, xdp 1, pi 1, features 8000000) RESULT: -1 TEST: (hdr 0, xdp 0, pi 0, features 108000000) RESULT: 0 TEST: (hdr 0, xdp 1, pi 0, features 108000000) RESULT: -1 TEST: (hdr 0, xdp 0, pi 1, features 108000000) RESULT: -1 TEST: (hdr 0, xdp 1, pi 1, features 108000000) RESULT: -1 > IFF_NO_PI + IFF_VNET_HDR, if I understand correctly. That's fairly much the only one that *did* work. As long as you use TUNSETSNDBUF which has the undocumented side-effect of turning off the XDP path. > > On the receive side, where the tun device generates the virtio_net_hdr > > but VIRITO_NET_F_MSG_RXBUF was negotiated and vhost-net needs to fill > > Nit: VIRTIO_NET_F_MSG_RXBUF Thanks. > > in the 'num_buffers' field on top of the existing virtio_net_hdr, fix > > that to use 'sock_hlen - 2' as the location, which means that it goes > > Please use sizeof(hdr.num_buffers) instead of a raw constant 2, to > self document the code. Makes sense. > Should this be an independent one-line fix? I don't think so; it's very much intertwined with the way it makes assumptions about someone else's data.