Skip to contentSkip to conversation

vhost: Fix vhost_copy_to_user()

PATCH In review Eric Auger 3 participants 6 messages Apr 11, 2018

Subsystems (6)
lore
Share & tools
lore

Eric Auger

author
#0 lore raw

PATCH 1/1 vhost: Fix vhost_copy_to_user()

vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")

---

This fixes a stall observed when running an aarch64 guest with virtual smmu

---
 drivers/vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +1 -1
index bec722e..f44aead 100644
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
 		struct iov_iter t;
 		void __user *uaddr = vhost_vq_meta_fetch(vq,
 				     (u64)(uintptr_t)to, size,
-				     VHOST_ADDR_DESC);
+				     VHOST_ADDR_USED);
 
 		if (uaddr)
 			return __copy_to_user(uaddr, from, size);
Signature · 1 line
2.5.5
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Eric Auger

vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")

---

This fixes a stall observed when running an aarch64 guest with virtual smmu

---
  drivers/vhost/vhost.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +0 -0
index bec722e..f44aead 100644

drivers/vhost/vhost.c static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to, · line 750

Quoted 8 lines
drivers/vhost/vhost.c +1 -1
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
  		struct iov_iter t;
  		void __user *uaddr = vhost_vq_meta_fetch(vq,
  				     (u64)(uintptr_t)to, size,
-				     VHOST_ADDR_DESC);
+				     VHOST_ADDR_USED);
 
  		if (uaddr)
  			return __copy_to_user(uaddr, from, size);

Thanks!

Stable material I think.

author
#2 lore raw

Hi Jason,

Quoted 33 lines · Jason Wang
Quoted 19 lines · Eric Auger

vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")

---

This fixes a stall observed when running an aarch64 guest with virtual smmu

---
  drivers/vhost/vhost.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +0 -0
index bec722e..f44aead 100644

drivers/vhost/vhost.c static int vhost_copy_to_user(struct · line 750

Quoted 8 lines
drivers/vhost/vhost.c +1 -1
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct
 vhost_virtqueue *vq, void __user *to,
          struct iov_iter t;
          void __user *uaddr = vhost_vq_meta_fetch(vq,
                       (u64)(uintptr_t)to, size,
-                     VHOST_ADDR_DESC);
+                     VHOST_ADDR_USED);
            if (uaddr)
              return __copy_to_user(uaddr, from, size);
Quoted 3 lines

Thanks!

Stable material I think.

yes I think so.

Thanks

Eric

author
#3 lore raw
In reply to Jason Wang

Hi Jason,

Quoted 33 lines · Jason Wang
Quoted 19 lines · Eric Auger

vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")

---

This fixes a stall observed when running an aarch64 guest with virtual smmu

---
  drivers/vhost/vhost.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +0 -0
index bec722e..f44aead 100644

drivers/vhost/vhost.c static int vhost_copy_to_user(struct · line 750

Quoted 8 lines
drivers/vhost/vhost.c +1 -1
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct
 vhost_virtqueue *vq, void __user *to,
          struct iov_iter t;
          void __user *uaddr = vhost_vq_meta_fetch(vq,
                       (u64)(uintptr_t)to, size,
-                     VHOST_ADDR_DESC);
+                     VHOST_ADDR_USED);
            if (uaddr)
              return __copy_to_user(uaddr, from, size);
Quoted 3 lines

Thanks!

Stable material I think.

yes I think so.

Thanks

Eric
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Acked-by on v1 1/1
#4 lore raw
In reply to Eric Auger
Quoted 19 lines · Eric Auger

vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")

---

This fixes a stall observed when running an aarch64 guest with virtual smmu

---
  drivers/vhost/vhost.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +0 -0
index bec722e..f44aead 100644

drivers/vhost/vhost.c static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to, · line 750

Quoted 8 lines
drivers/vhost/vhost.c +1 -1
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
  		struct iov_iter t;
  		void __user *uaddr = vhost_vq_meta_fetch(vq,
  				     (u64)(uintptr_t)to, size,
-				     VHOST_ADDR_DESC);
+				     VHOST_ADDR_USED);
 
  		if (uaddr)
  			return __copy_to_user(uaddr, from, size);

Thanks!

Stable material I think.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Eric Auger
Quoted 5 lines · Eric Auger

vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")
Quoted 23 lines

---

This fixes a stall observed when running an aarch64 guest with virtual smmu

---
 drivers/vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +1 -1
index bec722e..f44aead 100644
@@ -744,7 +744,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to,
 		struct iov_iter t;
 		void __user *uaddr = vhost_vq_meta_fetch(vq,
 				     (u64)(uintptr_t)to, size,
-				     VHOST_ADDR_DESC);
+				     VHOST_ADDR_USED);
 
 		if (uaddr)
 			return __copy_to_user(uaddr, from, size);
Signature · 1 line
2.5.5