netvsc_copy_to_send_buf() copies skb fragment pages into the shared VMBus send buffer using phys_to_virt() on the fragment PFN. On 32-bit x86 with CONFIG_HIGHMEM=y, phys_to_virt() (i.e. __va()) is only valid for LOWMEM addresses below 896 MiB. For a HIGHMEM page it returns an address that has no kernel page table entry and lies outside the kernel direct map, so the subsequent memcpy() faults. As this happens on the transmit softirq path, the fault is fatal. A HIGHMEM fragment reaches this path whenever the page backing an skb fragment lives above the LOWMEM boundary, which is common on a 32-bit guest with several GiB of RAM (for example when the in-kernel NFS server splices page cache pages directly into the reply skb). pb[i].pfn is a Hyper-V PFN at HV_HYP_PAGE_SIZE (4K) granularity. The physical address is reconstructed first and phys_to_page() is used to obtain the native struct page, with offset_in_page() added so the in-page offset stays correct where PAGE_SIZE > HV_HYP_PAGE_SIZE (e.g. arm64 with 64K pages). The page is then mapped on demand with kmap_local_page()/kunmap_local(). On !CONFIG_HIGHMEM configs kmap_local_page() reduces to page_address(), so this is a no-op there. Fixes: c25aaf814a63 ("hyperv: Enable sendbuf mechanism on the send path") Cc: stable@vger.kernel.org Signed-off-by: Anton Leontev --- v2: - Reconstruct the physical address from the Hyper-V PFN and use phys_to_page() + offset_in_page() instead of pfn_to_page() on the raw PFN, correct where PAGE_SIZE > 4K (e.g. arm64 64K pages). Reported by Haiyang Zhang. - Built for i386 (CONFIG_HIGHMEM) and arm64 (64K pages). drivers/net/hyperv/netvsc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 59e95341f9b1..2038d9f5c9f9 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -965,11 +966,14 @@ static void netvsc_copy_to_send_buf(struct netvsc_device *net_device, } for (i = 0; i < page_count; i++) { - char *src = phys_to_virt(pb[i].pfn << HV_HYP_PAGE_SHIFT); - u32 offset = pb[i].offset; + phys_addr_t paddr = pb[i].pfn << HV_HYP_PAGE_SHIFT; + struct page *page = phys_to_page(paddr); + u32 offset = offset_in_page(paddr) + pb[i].offset; u32 len = pb[i].len; + char *src = kmap_local_page(page); memcpy(dest, (src + offset), len); + kunmap_local(src); dest += len; } -- 2.43.0