This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 483e9efa23b03818b8d26de6162078dd3ac1612a
Author: Yongrong Wang <[email protected]>
AuthorDate: Wed Apr 30 17:20:09 2025 +0800

    kasan: fix the virtio transport write address error caused by kasan tag
    
    Convert the virtqueue ring addresses with up_addrenv_va_to_pa() so the
    device sees physical addresses rather than KASAN-tagged virtual ones.
    
    Signed-off-by: Yongrong Wang <[email protected]>
    Signed-off-by: wangjianyu3 <[email protected]>
---
 drivers/virtio/virtio-mmio.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/virtio/virtio-mmio.c b/drivers/virtio/virtio-mmio.c
index cc64581401a..dc689f850fd 100644
--- a/drivers/virtio/virtio-mmio.c
+++ b/drivers/virtio/virtio-mmio.c
@@ -358,18 +358,15 @@ static int virtio_mmio_config_virtqueue(FAR struct 
metal_io_region *io,
     {
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_NUM, vq->vq_nentries);
 
-      addr = (uint64_t)((uintptr_t)
-                        kasan_clear_tag((FAR void *)vq->vq_ring.desc));
+      addr = (uint64_t)up_addrenv_va_to_pa((FAR void *)vq->vq_ring.desc);
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_DESC_LOW, addr);
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_DESC_HIGH, addr >> 32);
 
-      addr = (uint64_t)((uintptr_t)
-                        kasan_clear_tag((FAR void *)vq->vq_ring.avail));
+      addr = (uint64_t)up_addrenv_va_to_pa((FAR void *)vq->vq_ring.avail);
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_AVAIL_LOW, addr);
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_AVAIL_HIGH, addr >> 32);
 
-      addr = (uint64_t)((uintptr_t)
-                        kasan_clear_tag((FAR void *)vq->vq_ring.used));
+      addr = (uint64_t)up_addrenv_va_to_pa((FAR void *)vq->vq_ring.used);
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_USED_LOW, addr);
       metal_io_write32(io, VIRTIO_MMIO_QUEUE_USED_HIGH, addr >> 32);
 

Reply via email to