vsock/virtio: large AF_VSOCK transfers reset under backpressure
Subsystems (4)
Hi Stefano,
Thanks, that matches what I'm seeing: large transfers reset mid-stream instead of the sender being throttled (reliable above ~1.5 MB, fine below ~90 KB).
The bind for me: it's not just this mail bridge -- I use AF_VSOCK for a few host/guest services, some of which open their own sockets, so the per-socket buffer workaround can't cover them all. That leaves pinning 6.12.90 (losing the DoS fix and further kernel updates) as the only blanket option.
A few quick questions:
1. Is a -stable backport of the merging fix likely, and roughly when?
2. Could a smaller interim land in -stable sooner (e.g. more default headroom) without reopening the DoS?
3. Will the fix guarantee backpressure for any packet size, or just widen the margin?
Happy to test any patch -- I have a solid reproducer and can turn it around in a day. I'll also file this as a tracked regression so it's not lost.
Thanks again,
Brien
#regzbot introduced: v6.12.90..v6.12.94
-----Original Message-----
From: Stefano Garzarella <[email protected]>
Sent: Monday, June 22, 2026 6:08 AM
To: Brien Oberstein <[email protected]>
Cc: [email protected]
Subject: Re: [REGRESSION 6.12.90 -> 6.12.94] vsock/virtio: large AF_VSOCK transfers reset under backpressure
Quoted 1 line · Brien Oberstein
Hi Stefano, Eric,
Hi Brien,
Quoted 51 lines
I'm hitting a regression in the 6.12.y stable series: a bulk transfer over
AF_VSOCKis torn down mid-stream once the message is large enough to exercise receiver-side backpressure. By stable version it lands on 6.12.94; 6.12.90 is fine.Setup
-----
A host process mails a guest's postfix over anAF_VSOCKbridge:host msmtp --(unix sock)--> socat --(AF_VSOCK: host CID 2 ->
guest CID 101, port 20025)--> [guest] socat --(TCP 127.0.0.1:25)--> postfixpostfix (TLS-terminating, then writing to its queue) drains the stream slower than the host writes it, so the per-socket vsock buffer fills during a large message.
Symptom (guest, 6.12.94)
------------------------
The guest-side socat exits status=1 mid-transfer and postfix logs:postfix/smtpd: NNN: lost connection after DATA (153330 bytes)
from localhost[127.0.0.1]
postfix/smtpd: disconnect ... data=0/1 commands=5/6On the host, msmtp reports:
msmtp: cannot write to TLS connection: The TLS connection was
non-properly terminated. (sendmail exit 74 /EX_TEMPFAIL)So the
AF_VSOCKconnection is dropped while data is still flowing, rather than the sender being throttled by the credit-based flow control.Reproduction
------------
Send messages of increasing size through the bridge:body <= ~88 KB : always succeeds
body ~354 KB : intermittent failure
body >= 1.5 MB : fails 12/12On 6.12.90 the identical test passes 20/20, including 1.5 MB x12, 2.4 MB x3, 4 MB x3 and 8 MB x2. The only variable is the guest kernel.
Bisection
---------
6.12.91, .92 and .93 carry no vsock changes. 6.12.94 pulled in three vsock/virtio commits:
Quoted 8 lines
1eca304fvsock/virtio: fix potential unbounded skb queuef3bf0f3bvsock/virtio: fix skb overhead accounting to preserve
fullbuf_alloc
149205a1vsock/virtio: fix skb overhead overflow on 32-bit buildsThe behaviour (drop/reset under a fast sender + slow receiver instead of applying backpressure) makes
1eca304fthe prime suspect, but I have only A/B tested whole stable releases, not the individual commits.
Yep, I'm working on a followup to improve the status.
Basically, the memory management in AF_VSOCK has always been broken. The patches you mentioned are designed to prevent one peer from consuming all of the other peer’s memory.
Instead of counting only the payload bytes, we now also take the packet metadata into account, using a socket buffer that is double the size set (default 256 KB).
So if your system is sending small packets, then this is likely hitting this issue.
My advice for now is to increase the socket buffer size. Thanks to VMware, AF_VSOCK have specific sockopts :-(:
- SO_VM_SOCKETS_BUFFER_SIZE (0)
- SO_VM_SOCKETS_BUFFER_MAX_SIZE (2)
I suggest to set both to 16 MB (MAX should be set first).
I tried this with socat and seems to work:
socat VSOCK-LISTEN:4242,setsockopt=40:2:x0000000001000000,setsockopt=40:0:x0000000001000000
Hope this helps.
In the mean time, I'm working on a follow-up for net-next to ensure that packets are merged when we exceed a threshold; we might be able to backport this to stable, but I'm not sure.
Thanks,
Stefano
Quoted 10 lines · Brien Oberstein
Hi Stefano,
Thanks, that matches what I'm seeing: large transfers reset mid-stream instead of the sender being throttled (reliable above ~1.5 MB, fine below ~90 KB).
The bind for me: it's not just this mail bridge -- I use
AF_VSOCKfor a few host/guest services, some of which open their own sockets, so the per-socket buffer workaround can't cover them all. That leaves pinning 6.12.90 (losing the DoS fix and further kernel updates) as the only blanket option.
Okay, but in that case did it work?
Quoted 4 lines
A few quick questions:
1. Is a -stable backport of the merging fix likely, and roughly when?
We don't have a fix yet.
Quoted 2 lines
2. Could a smaller interim land in -stable sooner (e.g. more default headroom) without reopening the DoS?
What we've merged so far is the best we can do for now, but anyone who wants to help improve the situation is welcome to submit patches.
Quoted 2 lines
3. Will the fix guarantee backpressure for any packet size, or just widen the margin?
It should fix STREAM sockets for any packet size.
SEQPACKET/DGRAM is a bit different since we need to keep boundaries, so it will come later if needed.
Quoted 2 lines
Happy to test any patch
THanks, I'll ask you to test.
Quoted 2 lines
I have a solid reproducer and can turn it around
in a day. I'll also file this as a tracked regression so it's not lost.
Unfortunately, it's always been partially broken, using more memory than specified, so I don't know if this is actually a full regression, but I understand.
Thanks,
Stefano
Hi Stefano,
Confirmed -- the 16 MB buffer fixes it: with socat owning the VSOCK-LISTEN and SO_VM_SOCKETS_BUFFER_MAX_SIZE/SIZE at 16 MB, a 6.12.94 guest passed 21/21 large transfers (1.5 MB x12 through 8 MB); the same 1.5 MB payload failed every time without it. So the per-socket workaround covers the bridges whose listen I control, but not vsock services I can't reconfigure, which stay broken on 6.12.94.
Agreed the old behaviour was buggy in its own right -- it was over-allocating past the advertised buffer. The practical effect for me is just that a config that worked on 6.12.90 no longer does on 6.12.94.
A question mainly for stable@: until the merging work lands, would an interim be acceptable -- something that keeps ordinary small-packet workloads under the limit without reopening the DoS? I don't have the kernel-side expertise to judge what's safe there, but I'm glad to prepare and test whatever interim you think is right, and to test the merging patch when it's ready.
Thanks,
Brien
-----Original Message-----
From: Stefano Garzarella <[email protected]>
Sent: Monday, June 22, 2026 8:22 AM
To: Brien Oberstein <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [REGRESSION 6.12.90 -> 6.12.94] vsock/virtio: large AF_VSOCK transfers reset under backpressure
Quoted 8 lines · Brien Oberstein
Hi Stefano,
Thanks, that matches what I'm seeing: large transfers reset mid-stream instead of the sender being throttled (reliable above ~1.5 MB, fine below ~90 KB).
The bind for me: it's not just this mail bridge -- I use
AF_VSOCKfor a few host/guest services, some of which open their own sockets, so the
per-socket
Quoted 2 lines
buffer workaround can't cover them all. That leaves pinning 6.12.90 (losing the DoS fix and further kernel updates) as the only blanket option.
Okay, but in that case did it work?
Quoted 4 lines
A few quick questions:
1. Is a -stable backport of the merging fix likely, and roughly when?
We don't have a fix yet.
Quoted 2 lines
2. Could a smaller interim land in -stable sooner (e.g. more default headroom) without reopening the DoS?
What we've merged so far is the best we can do for now, but anyone who wants to help improve the situation is welcome to submit patches.
Quoted 2 lines
3. Will the fix guarantee backpressure for any packet size, or just widen the margin?
It should fix STREAM sockets for any packet size. SEQPACKET/DGRAM is a bit different since we need to keep boundaries, so it will come later if needed.
Quoted 2 lines
Happy to test any patch
THanks, I'll ask you to test.
Quoted 2 lines
I have a solid reproducer and can turn it around
in a day. I'll also file this as a tracked regression so it's not lost.
Unfortunately, it's always been partially broken, using more memory than specified, so I don't know if this is actually a full regression, but I understand.
Thanks,
Stefano
Quoted 13 lines · Brien Oberstein
Hi Stefano,
Confirmed -- the 16 MB buffer fixes it: with socat owning the VSOCK-LISTEN and SO_VM_SOCKETS_BUFFER_MAX_SIZE/SIZE at 16 MB, a 6.12.94 guest passed 21/21 large transfers (1.5 MB x12 through 8 MB); the same 1.5 MB payload failed every time without it. So the per-socket workaround covers the bridges whose listen I control, but not vsock services I can't reconfigure, which stay broken on 6.12.94.
Agreed the old behaviour was buggy in its own right -- it was over-allocating past the advertised buffer. The practical effect for me is just that a config that worked on 6.12.90 no longer does on 6.12.94.
Quoted 6 lines
A question mainly for stable@: until the merging work lands, would an interim be acceptable -- something that keeps ordinary small-packet workloads under the limit without reopening the DoS? I don't have the kernel-side expertise to judge what's safe there, but I'm glad to prepare and test whatever interim you think is right, and to test the merging patch when it's ready.
Let me try something: one of my patches merges the SKBs when we exceed a certain threshold. That should be enough to fix this issue with STREAM sockets. I can extract this patch from my series (which does other things as well) and minimize the changes so it can be backported to the stable branch. I’ll see if I can send you a draft later today for testing.
Thanks,
Stefano
Quoted 64 lines
Thanks,
Brien-----Original Message-----
From: Stefano Garzarella <[email protected]>
Sent: Monday, June 22, 2026 8:22 AM
To: Brien Oberstein <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [REGRESSION 6.12.90 -> 6.12.94] vsock/virtio: largeAF_VSOCKtransfers reset under backpressureQuoted 8 lines · Brien Oberstein
Hi Stefano,
Thanks, that matches what I'm seeing: large transfers reset mid-stream instead of the sender being throttled (reliable above ~1.5 MB, fine below ~90 KB).
The bind for me: it's not just this mail bridge -- I use
AF_VSOCKfor a few host/guest services, some of which open their own sockets, so theper-socket
Quoted 2 lines
buffer workaround can't cover them all. That leaves pinning 6.12.90 (losing the DoS fix and further kernel updates) as the only blanket option.
Okay, but in that case did it work?
Quoted 4 lines
A few quick questions:
1. Is a -stable backport of the merging fix likely, and roughly when?
We don't have a fix yet.
Quoted 2 lines
2. Could a smaller interim land in -stable sooner (e.g. more default headroom) without reopening the DoS?
What we've merged so far is the best we can do for now, but anyone who wants to help improve the situation is welcome to submit patches.
Quoted 2 lines
3. Will the fix guarantee backpressure for any packet size, or just widen the margin?
It should fix STREAM sockets for any packet size. SEQPACKET/DGRAM is a bit different since we need to keep boundaries, so it will come later if needed.
Quoted 2 lines
Happy to test any patch
THanks, I'll ask you to test.
Quoted 2 lines
I have a solid reproducer and can turn it around
in a day. I'll also file this as a tracked regression so it's not lost.Unfortunately, it's always been partially broken, using more memory than specified, so I don't know if this is actually a full regression, but I understand.
Thanks,
Stefano