[v2,0/7] vhost: ensure virtqueue access status is checked

Message ID 20231020084804.3625099-1-maxime.coquelin@redhat.com (mailing list archive)
Headers
Series vhost: ensure virtqueue access status is checked |

Message

Maxime Coquelin Oct. 20, 2023, 8:47 a.m. UTC
  Li Feng initially reported segmentation fault in rte_vhost_vring_call()
because of not checking the virtqueue metadata can be accessed.

This should be achieved by checking the access_ok status field of
the virtqueue.

This series also takes the opportunity to fix the other APIs.
This is split in multiple patches to ease LTS maintainers backports,
but could be squashed if preferred.

Changes in v2:
--------------
- Rebased to apply on -rc1 (David)
- Add Fixes tag in patch 1 (David)
- Fix various typos in commit logs (David)

Maxime Coquelin (7):
  vhost: fix missing vring call check on virtqueue access
  vhost: fix missing check on virtqueue access
  vhost: fix checking virtqueue access when notifying guest
  vhost: fix check on virtqueue access in async registration
  vhost: fix check on virtqueue access in in-flight getter
  vhost: fix missing lock protection in power monitor API
  vhost: fix checking virtqueue access in stats API

 lib/vhost/vhost.c | 92 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 85 insertions(+), 7 deletions(-)
  

Comments

David Marchand Oct. 23, 2023, 10:01 a.m. UTC | #1
On Fri, Oct 20, 2023 at 10:48 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> Li Feng initially reported segmentation fault in rte_vhost_vring_call()
> because of not checking the virtqueue metadata can be accessed.
>
> This should be achieved by checking the access_ok status field of
> the virtqueue.
>
> This series also takes the opportunity to fix the other APIs.
> This is split in multiple patches to ease LTS maintainers backports,
> but could be squashed if preferred.

As a followup on this topic, I took some time to annotate this code
around access_ok/access_lock.
For those interested:
https://patchwork.dpdk.org/project/dpdk/list/?series=29950&state=%2A&archive=both
  
David Marchand Oct. 25, 2023, 11:40 a.m. UTC | #2
On Fri, Oct 20, 2023 at 10:48 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> Li Feng initially reported segmentation fault in rte_vhost_vring_call()
> because of not checking the virtqueue metadata can be accessed.
>
> This should be achieved by checking the access_ok status field of
> the virtqueue.
>
> This series also takes the opportunity to fix the other APIs.
> This is split in multiple patches to ease LTS maintainers backports,
> but could be squashed if preferred.
>
> Changes in v2:
> --------------
> - Rebased to apply on -rc1 (David)
> - Add Fixes tag in patch 1 (David)
> - Fix various typos in commit logs (David)
>
> Maxime Coquelin (7):
>   vhost: fix missing vring call check on virtqueue access
>   vhost: fix missing check on virtqueue access
>   vhost: fix checking virtqueue access when notifying guest
>   vhost: fix check on virtqueue access in async registration
>   vhost: fix check on virtqueue access in in-flight getter
>   vhost: fix missing lock protection in power monitor API
>   vhost: fix checking virtqueue access in stats API
>
>  lib/vhost/vhost.c | 92 +++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 85 insertions(+), 7 deletions(-)

For the series,
Acked-by: David Marchand <david.marchand@redhat.com>
  
Maxime Coquelin Oct. 25, 2023, 12:22 p.m. UTC | #3
On 10/20/23 10:47, Maxime Coquelin wrote:
> Li Feng initially reported segmentation fault in rte_vhost_vring_call()
> because of not checking the virtqueue metadata can be accessed.
> 
> This should be achieved by checking the access_ok status field of
> the virtqueue.
> 
> This series also takes the opportunity to fix the other APIs.
> This is split in multiple patches to ease LTS maintainers backports,
> but could be squashed if preferred.
> 
> Changes in v2:
> --------------
> - Rebased to apply on -rc1 (David)
> - Add Fixes tag in patch 1 (David)
> - Fix various typos in commit logs (David)
> 
> Maxime Coquelin (7):
>    vhost: fix missing vring call check on virtqueue access
>    vhost: fix missing check on virtqueue access
>    vhost: fix checking virtqueue access when notifying guest
>    vhost: fix check on virtqueue access in async registration
>    vhost: fix check on virtqueue access in in-flight getter
>    vhost: fix missing lock protection in power monitor API
>    vhost: fix checking virtqueue access in stats API
> 
>   lib/vhost/vhost.c | 92 +++++++++++++++++++++++++++++++++++++++++++----
>   1 file changed, 85 insertions(+), 7 deletions(-)
> 

Applied to next-virtio/for-next-net

Thanks,
Maxime