There's another bug here though, in the rollback at the end of
vhost_vdpa_va_map():

        if (ret)
                vhost_vdpa_unmap(v, iotlb, iova, map_iova - iova);

If the very first chunk fails, that's a zero-size unmap, and with
iova == 0 vhost_vdpa_unmap() computes last = U64_MAX and wipes every
mapping in the AS. This is already broken with find_vma() (a uaddr
above all VMAs gets there), vma_lookup() just makes it easier to hit.
Reproduced with vdpa_sim under QEMU.

So I'd fix the rollback first, then switch to vma_lookup(). Are you
planning a v3? If not I'm happy to pick it up and keep you credited.


Reply via email to