Thread (7 messages) 7 messages, 6 authors, 2026-03-27

Re: [PATCH net-next] virtio_net: sync RX buffer before reading the header

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2026-03-26 22:03:38
Also in: bpf, lkml, virtualization

On Thu, Mar 26, 2026 at 06:17:36PM +0000, Simon Horman wrote:
On Tue, Mar 24, 2026 at 11:15:54AM -0400, Michael S. Tsirkin wrote:
quoted
receive_buf() reads the virtio header through buf before
page_pool_dma_sync_for_cpu() runs in receive_small() or
receive_mergeable(). The header buffer is thus unsynchronized at the
point where flags and, for mergeable buffers, num_buffers are consumed.

Omar Elghoul reported that on s390x Secure Execution this showed up as
greatly reduced virtio-net performance together with "bad gso" and
"bad csum" messages in dmesg. This is because with SE sync actually
copies data, so the header is uninitialized.

Move the sync into receive_buf() so the
header is synchronized before any access through buf.

Tool use: Cursor with GPT-5.4 drafted the initial code move from prompt:
"in drivers/net/virtio_net.c, move page_pool_dma_sync_for_cpu on receive
path to before memory is accessed through buf".
The result and the commit log were reviewed and edited manually.

Fixes: 168b61da6871 ("virtio_net: add page_pool support for buffer allocation")
Hi Michael,

The hash for a patch with that subject in net-next appears to be 24fbd3967f3f.
Thanks, will fix in the next version.
quoted
Reported-by: Omar Elghoul <redacted>
Tested-by: Srikanth Aithal <redacted>
Tested-by: Omar Elghoul <redacted>
Link: https://lore.kernel.org/r/20260323150136.14452-1-oelghoul@linux.ibm.com (local)
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
...
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help