numam-dpdk/lib/librte_vhost
Maxime Coquelin d4ff2135eb vhost: enforce avail index and desc read ordering
A read barrier is required to ensure the ordering between
available index and the descriptor reads is enforced.

1. read avail_head = avail->idx
2. read cur_idx = last_avail_idx
if (cur_idx != avail_head) {
    3. read idx = avail->ring[cur_idx]
    4. read desc[idx]
}

There is a control dependency between step 1 and steps 3 & 4,
3 could be speculatively executed before 1, which could result
in 'idx' to not being updated yet.

Fixes: 4796ad63ba ("examples/vhost: import userspace vhost application")
Cc: stable@dpdk.org

Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Tiwei Bie <tiwei.bie@intel.com>
2018-12-21 16:22:41 +01:00
..
fd_man.c vhost: fix race condition when adding fd in the fdset 2018-12-21 16:22:40 +01:00
fd_man.h vhost: fix race condition when adding fd in the fdset 2018-12-21 16:22:40 +01:00
iotlb.c vhost: flush IOTLB cache on new mem table handling 2018-08-05 01:47:47 +02:00
iotlb.h vhost: flush IOTLB cache on new mem table handling 2018-08-05 01:47:47 +02:00
Makefile vhost/crypto: fix shared lib build without cryptodev 2018-10-26 22:14:05 +02:00
meson.build vhost: add config flag for postcopy 2018-10-18 10:24:39 +02:00
rte_vdpa.h vhost: provide helpers for virtio ring relay 2018-12-21 16:22:40 +01:00
rte_vhost_crypto.h vhost/crypto: add public function implementation 2018-04-14 00:43:30 +02:00
rte_vhost_version.map vhost: provide helpers for virtio ring relay 2018-12-21 16:22:40 +01:00
rte_vhost.h vhost: restrict postcopy live-migration enablement 2018-10-18 10:24:39 +02:00
socket.c vhost: fix race condition when adding fd in the fdset 2018-12-21 16:22:40 +01:00
vdpa.c vhost: provide helpers for virtio ring relay 2018-12-21 16:22:40 +01:00
vhost_crypto.c vhost/crypto: fix packet copy in chaining mode 2018-11-14 00:35:53 +01:00
vhost_user.c vhost: provide helper for host notifier ctrl 2018-12-21 16:22:40 +01:00
vhost_user.h vhost: enable postcopy protocol feature 2018-10-18 10:24:39 +02:00
vhost.c vhost: remove unused function 2018-12-21 16:22:40 +01:00
vhost.h vhost: provide helpers for virtio ring relay 2018-12-21 16:22:40 +01:00
virtio_crypto.h vhost: add virtio crypto header file 2018-04-14 00:43:30 +02:00
virtio_net.c vhost: enforce avail index and desc read ordering 2018-12-21 16:22:41 +01:00