vhost: add runtime locking check in unsafe API
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 11 May 2022 06:58:37 +0000 (08:58 +0200)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 1 Jun 2022 09:50:09 +0000 (11:50 +0200)
commit0a8363efdbeb92446d0fc1f11788a76f8b969daf
tree6559b859dcced7b75a3939052b4c3687007774e1
parent69c94e35d5832a5a492b8bd6c639e80d25d4cbfd
vhost: add runtime locking check in unsafe API

This patch adds runtime checks in unsafe Vhost async APIs,
to ensure the access lock is taken.

The detection won't work every time, as another thread
could take the lock, but it would help to detect misuse
of these unsafe API.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
lib/vhost/vhost.c
lib/vhost/virtio_net.c