[dpdk-stable] patch 'vfio: fix use after free with multiprocess' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 14:54:24 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 2ef98701189ff669783c9b5f0417ac8811b6fa56 Mon Sep 17 00:00:00 2001
From: "Wei Hu (Xavier)" <xavier.huwei at huawei.com>
Date: Tue, 21 Apr 2020 11:29:57 +0800
Subject: [PATCH] vfio: fix use after free with multiprocess

[ upstream commit d6298844da7e3e83034f1af196bdfddf388f979e ]

This patch fixes the heap-use-after-free bug which was found by ASAN
(Address-Sanitizer) in the vfio_get_default_container_fd function.

Fixes: 6bcb7c95fe14 ("vfio: share default container in multi-process")

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/librte_eal/linux/eal/eal_vfio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
index b82a5018bf..62ffe13e0e 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.c
+++ b/lib/librte_eal/linux/eal/eal_vfio.c
@@ -1049,6 +1049,7 @@ vfio_get_default_container_fd(void)
 	struct rte_mp_reply mp_reply = {0};
 	struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
 	struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;
+	int container_fd;
 
 	if (default_vfio_cfg->vfio_enabled)
 		return default_vfio_cfg->vfio_container_fd;
@@ -1071,8 +1072,9 @@ vfio_get_default_container_fd(void)
 		mp_rep = &mp_reply.msgs[0];
 		p = (struct vfio_mp_param *)mp_rep->param;
 		if (p->result == SOCKET_OK && mp_rep->num_fds == 1) {
+			container_fd = mp_rep->fds[0];
 			free(mp_reply.msgs);
-			return mp_rep->fds[0];
+			return container_fd;
 		}
 	}
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 13:56:21.811397667 +0100
+++ 0074-vfio-fix-use-after-free-with-multiprocess.patch	2020-05-19 13:56:18.303503332 +0100
@@ -1,26 +1,27 @@
-From d6298844da7e3e83034f1af196bdfddf388f979e Mon Sep 17 00:00:00 2001
+From 2ef98701189ff669783c9b5f0417ac8811b6fa56 Mon Sep 17 00:00:00 2001
 From: "Wei Hu (Xavier)" <xavier.huwei at huawei.com>
 Date: Tue, 21 Apr 2020 11:29:57 +0800
 Subject: [PATCH] vfio: fix use after free with multiprocess
 
+[ upstream commit d6298844da7e3e83034f1af196bdfddf388f979e ]
+
 This patch fixes the heap-use-after-free bug which was found by ASAN
 (Address-Sanitizer) in the vfio_get_default_container_fd function.
 
 Fixes: 6bcb7c95fe14 ("vfio: share default container in multi-process")
-Cc: stable at dpdk.org
 
 Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
 Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
 Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
 ---
- lib/librte_eal/linux/eal_vfio.c | 4 +++-
+ lib/librte_eal/linux/eal/eal_vfio.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
-diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c
-index 1979f6fdd8..d26e1649a5 100644
---- a/lib/librte_eal/linux/eal_vfio.c
-+++ b/lib/librte_eal/linux/eal_vfio.c
-@@ -1092,6 +1092,7 @@ vfio_get_default_container_fd(void)
+diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
+index b82a5018bf..62ffe13e0e 100644
+--- a/lib/librte_eal/linux/eal/eal_vfio.c
++++ b/lib/librte_eal/linux/eal/eal_vfio.c
+@@ -1049,6 +1049,7 @@ vfio_get_default_container_fd(void)
  	struct rte_mp_reply mp_reply = {0};
  	struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
  	struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;
@@ -28,7 +29,7 @@
  
  	if (default_vfio_cfg->vfio_enabled)
  		return default_vfio_cfg->vfio_container_fd;
-@@ -1114,8 +1115,9 @@ vfio_get_default_container_fd(void)
+@@ -1071,8 +1072,9 @@ vfio_get_default_container_fd(void)
  		mp_rep = &mp_reply.msgs[0];
  		p = (struct vfio_mp_param *)mp_rep->param;
  		if (p->result == SOCKET_OK && mp_rep->num_fds == 1) {


More information about the stable mailing list