vfio: do not use memcmp() to compare PCI address
PATCH 1/1 vfio: do not use memcmp() to compare PCI address
PCI address structure has padding which may have garbage.
---
It is a real bug which I've hit during multi-process debugging.
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +2 -1
@@ -355,7 +355,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) }else {/* if we're in a secondary process, just find our tailq entry */ TAILQ_FOREACH(vfio_res, vfio_res_list, next) { -if (memcmp (&vfio_res->pci_addr, &dev->addr,sizeof (dev->addr))) +if (rte_eal_compare_pci_addr (&vfio_res->pci_addr, + &dev->addr))continue ;break ; }
Signature · 1 line
2.9.3
Quoted 17 lines · Andrew Rybchenko
PCI address structure has padding which may have garbage.
Fixes 2f4adfad0a69 ("vfio: add multiprocess support")Signed-off-by Andrew Rybchenko <[email protected]>---
It is a real bug which I've hit during multi-process debugging.lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +0
-0
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c pci_vfio_map_resource(struct rte_pci_device *dev) · line 362
Quoted 9 lines
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +2
-1@@ -355,7 +355,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) }else {/* if we're in a secondary process, just find our tailq entry */ TAILQ_FOREACH(vfio_res, vfio_res_list, next) { -if (memcmp (&vfio_res->pci_addr, &dev->addr,sizeof (dev->addr))) +if (rte_eal_compare_pci_addr (&vfio_res->pci_addr, + &dev->addr))continue ;break ; }
Different commit, same patch :)
http://dpdk.org/dev/patchwork/patch/21828/
Regards,
Sergio
Quoted 24 lines · Sergio Gonzalez Monroy
Quoted 23 lines · Andrew Rybchenko
PCI address structure has padding which may have garbage.
Fixes 2f4adfad0a69 ("vfio: add multiprocess support")Signed-off-by Andrew Rybchenko <[email protected]>---
It is a real bug which I've hit during multi-process debugging.lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +0
-0@@ -355,7 +355,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) }else {/* if we're in a secondary process, just find our tailq entry */
TAILQ_FOREACH(vfio_res, vfio_res_list, next) {- if (memcmp(&vfio_res->pci_addr,
&dev->addr,sizeof(dev->addr)))
Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c pci_vfio_map_resource(struct rte_pci_device *dev) · line 362
Quoted 5 lines
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +2
-0+if (rte_eal_compare_pci_addr (&vfio_res->pci_addr, + &dev->addr))continue ;break ; }
True, sorry, lost your patch from my view.
I'm not sure which state should be set on my patch in the patchwork. Thomas, please, resolve it properly.
Thanks,
Andrew.
Quoted 35 lines · Andrew Rybchenko
Quoted 24 lines · Sergio Gonzalez Monroy
Quoted 23 lines · Andrew Rybchenko
PCI address structure has padding which may have garbage.
Fixes 2f4adfad0a69 ("vfio: add multiprocess support")Signed-off-by Andrew Rybchenko <[email protected]>---
It is a real bug which I've hit during multi-process debugging.lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +0
-0@@ -355,7 +355,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) }else {/* if we're in a secondary process, just find our tailq entry */
TAILQ_FOREACH(vfio_res, vfio_res_list, next) {- if (memcmp(&vfio_res->pci_addr,
&dev->addr,sizeof(dev->addr)))Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c pci_vfio_map_resource(struct rte_pci_device *dev) · line 362
Quoted 5 lines
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +2
-0+if (rte_eal_compare_pci_addr (&vfio_res->pci_addr, + &dev->addr))continue ;break ; }
Quoted 3 lines
True, sorry, lost your patch from my view.
I'm not sure which state should be set on my patch in the patchwork. Thomas, please, resolve it properly.
No worries. Probably the title on the other patch was a bit misleading.
You could just set it to the "Not Applicable" state.
Sergio
Quoted 2 lines
Thanks,
Andrew.