> virtnet_xsk_pool_enable() DMA maps the static xsk_hdr, which lives in
> the kernel image. On arm64 the kernel image is mapped in the vmalloc
> area, so when the device uses the DMA API the mapping is rejected:
> 
>   virtio_net virtio0: rejecting DMA map of vmalloc memory
>   WARNING: drivers/virtio/virtio_ring.c:3882 ...
> 
> and binding an AF_XDP zero-copy socket fails with -ENOMEM.
> 
> Allocate the all-zero header per send queue when the pool is enabled
> and free it when it is disabled.
> 
> This was found while testing AF_XDP in QEMU on arm64, not in
> production. Tested in QEMU (TCG, arm64 virt, virtio-net-pci with
> iommu_platform=on) with a KASAN kernel: binding an XDP_ZEROCOPY socket
> fails without this patch and succeeds with it.
> 
> Fixes: 21a4e3ce6dc7 ("virtio_net: xsk: bind/unbind xsk for tx")
> Signed-off-by: Haishuang Yan <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1


Reply via email to