* [dpdk-dev] [PATCH] vhost: fix crash on NUMA
@ 2017-06-02 0:14 Yuanhan Liu
2017-06-02 8:20 ` Jens Freimann
2017-06-02 14:24 ` [dpdk-dev] " Loftus, Ciara
0 siblings, 2 replies; 4+ messages in thread
From: Yuanhan Liu @ 2017-06-02 0:14 UTC (permalink / raw)
To: dev; +Cc: Maxime Coquelin, Yuanhan Liu, stable
The queue allocation was changed, from allocating one queue-pair at a
time to one queue at a time. Most of the changes have been done, but
just with one being missed: the size of coping the old queue is still
based on queue-pair at numa_realloc(), which leads to overwritten issue.
As a result, crash may happen.
Fix it by specifying the right copy size. Also, the net queue macros
are not used any more. Remove them.
Fixes: ab4d7b9f1afc ("vhost: turn queue pair to vring")
Cc: stable@dpdk.org
Reported-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
lib/librte_vhost/vhost_user.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 5c8058b..e486b78 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -238,8 +238,6 @@ numa_realloc(struct virtio_net *dev, int index)
struct vhost_virtqueue *old_vq, *vq;
int ret;
- enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
-
old_dev = dev;
vq = old_vq = dev->virtqueue[index];
@@ -261,7 +259,7 @@ numa_realloc(struct virtio_net *dev, int index)
if (!vq)
return dev;
- memcpy(vq, old_vq, sizeof(*vq) * VIRTIO_QNUM);
+ memcpy(vq, old_vq, sizeof(*vq));
rte_free(old_vq);
}
--
2.8.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix crash on NUMA
2017-06-02 0:14 [dpdk-dev] [PATCH] vhost: fix crash on NUMA Yuanhan Liu
@ 2017-06-02 8:20 ` Jens Freimann
2017-06-04 3:08 ` [dpdk-dev] [dpdk-stable] " Yuanhan Liu
2017-06-02 14:24 ` [dpdk-dev] " Loftus, Ciara
1 sibling, 1 reply; 4+ messages in thread
From: Jens Freimann @ 2017-06-02 8:20 UTC (permalink / raw)
To: Yuanhan Liu; +Cc: dev, Maxime Coquelin, stable
On Fri, Jun 02, 2017 at 08:14:46AM +0800, Yuanhan Liu wrote:
> The queue allocation was changed, from allocating one queue-pair at a
> time to one queue at a time. Most of the changes have been done, but
> just with one being missed: the size of coping the old queue is still
s/coping/copying/ ?
> based on queue-pair at numa_realloc(), which leads to overwritten issue.
> As a result, crash may happen.
>
> Fix it by specifying the right copy size. Also, the net queue macros
> are not used any more. Remove them.
>
> Fixes: ab4d7b9f1afc ("vhost: turn queue pair to vring")
>
> Cc: stable@dpdk.org
> Reported-by: Ciara Loftus <ciara.loftus@intel.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> lib/librte_vhost/vhost_user.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
Reviewed-by: Jens Freimann <jfreiman@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix crash on NUMA
2017-06-02 0:14 [dpdk-dev] [PATCH] vhost: fix crash on NUMA Yuanhan Liu
2017-06-02 8:20 ` Jens Freimann
@ 2017-06-02 14:24 ` Loftus, Ciara
1 sibling, 0 replies; 4+ messages in thread
From: Loftus, Ciara @ 2017-06-02 14:24 UTC (permalink / raw)
To: Yuanhan Liu, dev; +Cc: Maxime Coquelin, stable
> The queue allocation was changed, from allocating one queue-pair at a
> time to one queue at a time. Most of the changes have been done, but
> just with one being missed: the size of coping the old queue is still
> based on queue-pair at numa_realloc(), which leads to overwritten issue.
> As a result, crash may happen.
>
> Fix it by specifying the right copy size. Also, the net queue macros
> are not used any more. Remove them.
>
> Fixes: ab4d7b9f1afc ("vhost: turn queue pair to vring")
>
> Cc: stable@dpdk.org
> Reported-by: Ciara Loftus <ciara.loftus@intel.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
> lib/librte_vhost/vhost_user.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 5c8058b..e486b78 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -238,8 +238,6 @@ numa_realloc(struct virtio_net *dev, int index)
> struct vhost_virtqueue *old_vq, *vq;
> int ret;
>
> - enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
> -
> old_dev = dev;
> vq = old_vq = dev->virtqueue[index];
>
> @@ -261,7 +259,7 @@ numa_realloc(struct virtio_net *dev, int index)
> if (!vq)
> return dev;
>
> - memcpy(vq, old_vq, sizeof(*vq) * VIRTIO_QNUM);
> + memcpy(vq, old_vq, sizeof(*vq));
> rte_free(old_vq);
> }
>
> --
> 2.8.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] vhost: fix crash on NUMA
2017-06-02 8:20 ` Jens Freimann
@ 2017-06-04 3:08 ` Yuanhan Liu
0 siblings, 0 replies; 4+ messages in thread
From: Yuanhan Liu @ 2017-06-04 3:08 UTC (permalink / raw)
To: Jens Freimann; +Cc: dev, Maxime Coquelin, stable
On Fri, Jun 02, 2017 at 10:20:38AM +0200, Jens Freimann wrote:
> On Fri, Jun 02, 2017 at 08:14:46AM +0800, Yuanhan Liu wrote:
> > The queue allocation was changed, from allocating one queue-pair at a
> > time to one queue at a time. Most of the changes have been done, but
> > just with one being missed: the size of coping the old queue is still
>
> s/coping/copying/ ?
right, thanks.
>
> > based on queue-pair at numa_realloc(), which leads to overwritten issue.
> > As a result, crash may happen.
> >
> > Fix it by specifying the right copy size. Also, the net queue macros
> > are not used any more. Remove them.
> >
> > Fixes: ab4d7b9f1afc ("vhost: turn queue pair to vring")
> >
> > Cc: stable@dpdk.org
> > Reported-by: Ciara Loftus <ciara.loftus@intel.com>
> > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> > ---
> > lib/librte_vhost/vhost_user.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
>
> Reviewed-by: Jens Freimann <jfreiman@redhat.com>
Applied to dpdk-next-virtio.
--yliu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-04 3:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 0:14 [dpdk-dev] [PATCH] vhost: fix crash on NUMA Yuanhan Liu
2017-06-02 8:20 ` Jens Freimann
2017-06-04 3:08 ` [dpdk-dev] [dpdk-stable] " Yuanhan Liu
2017-06-02 14:24 ` [dpdk-dev] " Loftus, Ciara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).