Netdev List
 help / color / mirror / Atom feed
* [PATCH net 0/2] packet: fix PACKET_TX_RING data corruption on skb_orphan
@ 2026-09-14 21:37 Willem de Bruijn
  2026-09-14 21:37 ` [PATCH net 1/2] virtio_net: copy zerocopy frags in start_xmit without NAPI Willem de Bruijn
  2026-09-14 21:37 ` [PATCH net 2/2] packet: use ubuf_info completion for TX_RING packets Willem de Bruijn
  0 siblings, 2 replies; 7+ messages in thread
From: Willem de Bruijn @ 2026-09-14 21:37 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, edumazet, pabeni, horms, andrew+netdev,
	Willem de Bruijn

From: Willem de Bruijn <willemb@google.com>

When transmitting packets via PACKET_TX_RING, tpacket_snd links user
ring buffer pages as skb frags and releases the slot on skb->destructor
(tpacket_destruct_skb).

skb_orphan() invokes the destructor while the skb is still alive.
This marks the slot as TP_STATUS_AVAILABLE prematurely, allowing
userspace to overwrite the slot and causing data corruption.

This series fixes the issue by switching PACKET_TX_RING to standard
ubuf_info zerocopy completion, ensuring ring slots are released only
after all payload references are freed or copied.

Virtio-net needs a separate solution, because deferring the release
can cause deadlock in its !use_napi mode.

- Patch 1 addresses the virtio-net special case.
- Patch 2 converts tpacket_snd to standard ubuf_info completion

Patch 1 must be applied, and backported, before patch 2. Both carry
the same Fixes tag for that reason.

Willem de Bruijn (2):
  virtio_net: copy zerocopy frags in start_xmit without NAPI
  packet: use ubuf_info completion for TX_RING packets

 drivers/net/virtio_net.c |  7 ++++
 include/linux/skbuff.h   | 19 +---------
 net/packet/af_packet.c   | 82 +++++++++++++++++++++++++++-------------
 3 files changed, 63 insertions(+), 45 deletions(-)

-- 
2.55.0.1032.g73a4cd73de-goog


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

end of thread, other threads:[~2026-09-17 13:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 21:37 [PATCH net 0/2] packet: fix PACKET_TX_RING data corruption on skb_orphan Willem de Bruijn
2026-09-14 21:37 ` [PATCH net 1/2] virtio_net: copy zerocopy frags in start_xmit without NAPI Willem de Bruijn
2026-09-16  0:37   ` netdev-bot+sashiko
2026-09-14 21:37 ` [PATCH net 2/2] packet: use ubuf_info completion for TX_RING packets Willem de Bruijn
2026-09-16  0:37   ` netdev-bot+sashiko
2026-09-17  9:16   ` Paolo Abeni
2026-09-17 13:28     ` Willem de Bruijn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox