Files
rawdigits 2bc200103f tun/linux: coalesce WriteGSO into single write() to avoid 4.19 UAF
The scatter-gather writev path in WriteGSO triggered a kernel-side
use-after-free in tun_chr_write_iter → sock_alloc_send_pskb →
skb_set_owner_w on Linux 4.19 TUN when the virtio_net_hdr requested
TSO segmentation. The skb write-memory refcount (sk_wmem_alloc)
underflowed, producing paired traces of refcount_t: addition on 0
(in the write path) and refcount_t: underflow (in the paired recv
socket), reliably rebooting UBIOS UXG-Pro routers under iperf3 -R.

Match wireguard-go's design: coalesce the virtio_net_hdr, IP/TCP
header, and all payload fragments into a single contiguous per-queue
scratch buffer, then emit the superpacket with a single write()
syscall. wireguard-go's offload path handles GRO-merged TSO
superpackets this way and has no equivalent failure mode (see
tun/tun_linux.go Write — it writes bufs[bufsI][offset:] with a
single tunFile.Write call after coalesce).

Cost: one extra memcpy per superpacket (bounded at ~64KiB by the
virtio spec).

Unit tests pass (go test ./overlay/tio/...). Field testing on
UXG-Pro (4.19) pending.
2026-04-24 22:21:51 +00:00
..
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
fix
2026-04-21 14:52:28 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-23 11:35:51 -05:00
2026-04-23 11:35:51 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-21 13:31:16 -05:00
2026-04-23 11:35:51 -05:00