All of lore.kernel.org
 help / color / mirror / Atom feed
* [net PATCH 0/4] virtio_net: several bugs in XDP code for driver virtio_net
@ 2018-02-20 13:31 Jesper Dangaard Brouer
  2018-02-20 13:32 ` [net PATCH 1/4] virtio_net: disable XDP_REDIRECT in receive_mergeable() case Jesper Dangaard Brouer
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jesper Dangaard Brouer @ 2018-02-20 13:31 UTC (permalink / raw)
  To: Jason Wang
  Cc: Michael S. Tsirkin, netdev, John Fastabend, Alexei Starovoitov,
	Saeed Mahameed, Jesper Dangaard Brouer, Daniel Borkmann,
	David S. Miller, Tariq Toukan

The virtio_net driver actually violates the original memory model of
XDP causing hard to debug crashes.  Per request of John Fastabend,
instead of removing the XDP feature I'm fixing as much as possible.
While testing virtio_net with XDP_REDIRECT I found 4 different bugs.

Patch-1: not enough tail-room for build_skb in receive_mergeable()
 only option is to disable XDP_REDIRECT in receive_mergeable()

Patch-2: XDP in receive_small() basically never worked (check wrong flag)

Patch-3: fix memory leak for XDP_REDIRECT in error cases

Patch-4: avoid crash when ndo_xdp_xmit is called on dev not ready for XDP

In the longer run, we should consider introducing a separate receive
function when attaching an XDP program, and also change the memory
model to be compatible with XDP when attaching an XDP prog.

---

Jesper Dangaard Brouer (4):
      virtio_net: disable XDP_REDIRECT in receive_mergeable() case
      virtio_net: fix XDP code path in receive_small()
      virtio_net: fix memory leak in XDP_REDIRECT
      virtio_net: fix ndo_xdp_xmit crash towards dev not ready for XDP


 drivers/net/virtio_net.c |   58 +++++++++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 24 deletions(-)

--

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-02-27  2:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-20 13:31 [net PATCH 0/4] virtio_net: several bugs in XDP code for driver virtio_net Jesper Dangaard Brouer
2018-02-20 13:32 ` [net PATCH 1/4] virtio_net: disable XDP_REDIRECT in receive_mergeable() case Jesper Dangaard Brouer
2018-02-20 16:56   ` John Fastabend
2018-02-27  0:40   ` Michael S. Tsirkin
2018-02-27  2:25     ` Jason Wang
2018-02-27  2:28       ` Jason Wang
2018-02-20 13:32 ` [net PATCH 2/4] virtio_net: fix XDP code path in receive_small() Jesper Dangaard Brouer
2018-02-20 16:57   ` John Fastabend
2018-02-20 13:32 ` [net PATCH 3/4] virtio_net: fix memory leak in XDP_REDIRECT Jesper Dangaard Brouer
2018-02-20 16:59   ` John Fastabend
2018-02-20 13:32 ` [net PATCH 4/4] virtio_net: fix ndo_xdp_xmit crash towards dev not ready for XDP Jesper Dangaard Brouer
2018-02-20 17:01   ` John Fastabend
2018-02-21 20:09 ` [net PATCH 0/4] virtio_net: several bugs in XDP code for driver virtio_net David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.