vhost: check all range is mapped when translating GPAs
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 23 Jan 2018 13:26:02 +0000 (14:26 +0100)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Mon, 23 Apr 2018 14:04:30 +0000 (16:04 +0200)
commit070aceda33ac820ce78e1552ddf6e2b0d7d127eb
tree1f080c42c39283d8fe59ed127c3e2c29cb256b07
parentc6ae7de0defc1ac4c9036a6a3395eb196422bbf7
vhost: check all range is mapped when translating GPAs

There is currently no check done on the length when translating
guest addresses into host virtual addresses. Also, there is no
guanrantee that the guest addresses range is contiguous in
the host virtual address space.

This patch prepares vhost_iova_to_vva() and its callers to
return and check the mapped size. If the mapped size is smaller
than the requested size, the caller handle it as an error.

This issue has been assigned CVE-2018-1059.

Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost.c
lib/librte_vhost/vhost.h
lib/librte_vhost/virtio_net.c