Repository navigation
Conversation
cd474d5 to
d174a7a
Compare
|
@jwhited could you take a look please ? |
|
I am going to look at this either today or tomorrow. Thanks for the PR! |
illotum
left a comment
There was a problem hiding this comment.
Thanks for the submission! We try to be intentional with every change in this repo, so I encourage you to think how this can be made into a small surgical fix.
d174a7a to
f3d5899
Compare
|
Re-tested the reworked commit on a GCE subnet router (
The bad packets show up within seconds of enabling hardware GRO; steady state with GRO on stayed clean for both binaries over 180 s (1.6-1.7 GB each). |
|
thinking: Is your case covered if we take the error handling change out? No new sentinel, no handleVirtioRead split to join errs, only the csum fixup on L804 and the rest handled by GSOSplit as before. We do need to improve tun error resiliency, but ideally in a dedicated issue. This might also reduce your testing suite. |
f3d5899 to
6f7bb54
Compare
|
Yes, the fixup alone covers it. Dropped the sentinel, the Re-ran on the GCE router with this exact commit on v1.104.7, What is left uncovered, for the resiliency issue: a hardware-GRO packet the fixup cannot parse (IPv6 extension headers, protocol not matching the GSO type) still closes the device, as today. |
A GSO packet aggregated by NIC hardware GRO and forwarded into the TUN
device is CHECKSUM_UNNECESSARY, not CHECKSUM_PARTIAL, so the kernel hands
it over without VIRTIO_NET_HDR_F_NEEDS_CSUM and with csum_start and
csum_offset left at zero. handleVirtioRead then read the TCP data offset
from the IPv4 source address ("tcp header len is invalid: 0" for 10/8)
and RoutineReadFromTUN closed the device on that error. gve (Google Cloud
gVNIC) enables hardware GRO by default since Linux 7.1, also backported
to Ubuntu linux-gcp 7.0.0-1017, so every subnet router on such a VM lost
its tunnel seconds after starting. The gve fix (netdev/net bda3c8381653,
queued for 7.4 and stable) marks these packets CHECKSUM_PARTIAL.
When CsumStart is zero, take CsumStart and CsumOffset from the packet's
own IP header; GSOSplit already recomputes every segment's checksums.
Drop a packet whose offsets cannot be repaired this way, such as IPv6
with extension headers, instead of closing the device.
Updates tailscale/tailscale#22298
Signed-off-by: Stephane Loeuillet <stephane.loeuillet@kaiko.com>
6f7bb54 to
5149eb0
Compare
Updates tailscale/tailscale#22298
With hardware GRO on the receiving NIC, a forwarded GSO packet is
CHECKSUM_UNNECESSARY, so the kernel hands it to the TUN device withoutVIRTIO_NET_HDR_F_NEEDS_CSUMand withcsum_start/csum_offset= 0.handleVirtioReadthen reads the TCP data offset from the IPv4 source address (tcp header len is invalid: 0for 10/8), andRoutineReadFromTUNcloses the device on that error.gve(Google Cloud gVNIC) enables hardware GRO by default since Linux 7.1, also backported to Ubuntulinux-gcp7.0.0-1017, so a subnet router on such a VM loses its tunnel seconds after starting. The gve fix (netdev/net bda3c8381653, queued for 7.4 and stable) marks these packetsCHECKSUM_PARTIAL.When
CsumStartis 0 on a GSO packet, takeCsumStart/CsumOffsetfrom the packet's own IP header (protocol checked against the GSO type).GSOSplitalready recomputes every segment's checksums. A packet the fixup cannot handle (e.g. IPv6 extension headers) is dropped instead of closing the device.Tests: new
handleVirtioReadcases, which fail without the change (the TCP ones with the exact production error);go test ./...passes on Linux. On a GCE router (linux-gcp7.0.0-1017), tailscale v1.104.7 with this commit vs stock,rx-gro-hwtoggled on 6 times under load: 0/6 crashes vs 6/6.