DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] *rte_vhost_rx_queue_count* should  be protected by vq->access_lock
@ 2019-08-14  3:31 He Peng
  2019-08-15  6:07 ` Tiwei Bie
  0 siblings, 1 reply; 4+ messages in thread
From: He Peng @ 2019-08-14  3:31 UTC (permalink / raw)
  To: dev
  Cc: \"CHENCHONG1 [陈冲]\,
	\"YEXIAOFENG1 [叶小峰]\

Hi,


We found that *rte_vhost_rx_queue_count* is not protected by vq->access_lock,
and the access to vq->avail->idx is not thread-safe, since at the same time, the vq->avail  might be 

set by *vring_invalidate* when some vhost-user messages arrived, such as VRING_SET_ADDRESS,
VRING_SET_MEM_TABLE, etc.


Thanks. 





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] *rte_vhost_rx_queue_count* should be protected by vq->access_lock
  2019-08-14  3:31 [dpdk-dev] *rte_vhost_rx_queue_count* should be protected by vq->access_lock He Peng
@ 2019-08-15  6:07 ` Tiwei Bie
  0 siblings, 0 replies; 4+ messages in thread
From: Tiwei Bie @ 2019-08-15  6:07 UTC (permalink / raw)
  To: He Peng
  Cc: dev, \"CHENCHONG1 [陈冲]\,
	\"YEXIAOFENG1 [叶小峰]\

On Wed, Aug 14, 2019 at 03:31:09AM +0000, He Peng wrote:
> Hi,
> 
> We found that *rte_vhost_rx_queue_count* is not protected by vq->access_lock,
> and the access to vq->avail->idx is not thread-safe, since at the same time, the vq->avail  might be 
> 
> set by *vring_invalidate* when some vhost-user messages arrived, such as VRING_SET_ADDRESS,
> VRING_SET_MEM_TABLE, etc.

You are right. And other similar APIs also need to be protected.
Thanks for reporting this!

Thanks,
Tiwei


> 
> 
> Thanks. 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev]   *rte_vhost_rx_queue_count* should  be protected by vq->access_lock
  2019-08-15  9:14 He Peng
@ 2019-08-15 13:41 ` Tiwei Bie
  0 siblings, 0 replies; 4+ messages in thread
From: Tiwei Bie @ 2019-08-15 13:41 UTC (permalink / raw)
  To: He Peng
  Cc: dev, \"CHENCHONG1 [陈冲]\,
	\"YEXIAOFENG1 [叶小峰]\

On Thu, Aug 15, 2019 at 09:14:52AM +0000, He Peng wrote:
> Hi,
> 
> 
> Would you please provide  a list of impacted APIs, thus we can check if our code has further issues. b.t.w, we are now using dpdk 18.11.

I'm looking into this issue. The API of the builtin backend
is supposed to be protected like enqueue/dequeue. So e.g.
rte_vhost_enable_guest_notification should also be protected.
I'll keep you in the CC list of the fix patch.

Thanks,
Tiwei

> 
> 
> Thanks.
> 
> 2019年8月14日 下午11:09,Tiwei Bie <tiwei.bie@intel.com> 写道:
> 
> 
> On Wed, Aug 14, 2019 at 03:31:09AM +0000, He Peng wrote:
> 
> Hi,
> 
> 
> We found that *rte_vhost_rx_queue_count* is not protected by vq->access_lock,
> and the access to vq->avail->idx is not thread-safe, since at the same time, the vq->avail  might be 
> 
> 
> set by *vring_invalidate* when some vhost-user messages arrived, such as VRING_SET_ADDRESS,
> VRING_SET_MEM_TABLE, etc.
> 
> You are right. And other similar APIs also need to be protected.
> Thanks for reporting this!
> 
> Thanks,
> Tiwei
> 
> 
> 
> 
> 
> 
> 
> Thanks. 
> 
> 
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev]   *rte_vhost_rx_queue_count* should  be protected by vq->access_lock
@ 2019-08-15  9:14 He Peng
  2019-08-15 13:41 ` Tiwei Bie
  0 siblings, 1 reply; 4+ messages in thread
From: He Peng @ 2019-08-15  9:14 UTC (permalink / raw)
  To: Tiwei Bie
  Cc: dev, \"CHENCHONG1 [陈冲]\,
	\"YEXIAOFENG1 [叶小峰]\

Hi,


Would you please provide  a list of impacted APIs, thus we can check if our code has further issues. b.t.w, we are now using dpdk 18.11.


Thanks.

2019年8月14日 下午11:09,Tiwei Bie <tiwei.bie@intel.com> 写道:


On Wed, Aug 14, 2019 at 03:31:09AM +0000, He Peng wrote:

Hi,


We found that *rte_vhost_rx_queue_count* is not protected by vq->access_lock,
and the access to vq->avail->idx is not thread-safe, since at the same time, the vq->avail  might be 


set by *vring_invalidate* when some vhost-user messages arrived, such as VRING_SET_ADDRESS,
VRING_SET_MEM_TABLE, etc.

You are right. And other similar APIs also need to be protected.
Thanks for reporting this!

Thanks,
Tiwei







Thanks. 









^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14  3:31 [dpdk-dev] *rte_vhost_rx_queue_count* should be protected by vq->access_lock He Peng
2019-08-15  6:07 ` Tiwei Bie
2019-08-15  9:14 He Peng
2019-08-15 13:41 ` Tiwei Bie

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox