> [ Upstream commit 29dfa436bc488056a84ee423ba82336db453e2a6 ] > > An RX queue that uses the DMA API (rq->use_page_pool_dma, for example > with VIRTIO_F_ACCESS_PLATFORM) syncs each received buffer with > page_pool_dma_sync_for_cpu() using the length the device wrote to the > used ring, and checks that length against the posted buffer only after > the sync. > > With SWIOTLB bouncing (swiotlb=force, or a confidential-computing > guest), the sync copies from the shared bounce buffer into the guest's > private page, so an oversized length also copies the bytes the device > wrote past the posted buffer over the neighbouring page pool fragments. > The later check drops the packet, but the copy has already happened. A > malicious device, such as a host the confidential guest does not > trust, can overwrite guest kernel memory next to an RX buffer with > [ ... ] > existing checks then drop the packet. Tested with the reproducer > described above: without this patch the marker reaches the guest page > for small and mergeable buffers; with it the sync stops at the posted > length and the packets are counted in rx_length_errors. ] > Signed-off-by: Vladimir Petrzhikovskii <[email protected]>
Sashiko has reviewed this patch and found no issues. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
