qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition
@ 2016-03-21 22:00 Bandan Das
  2016-03-21 22:34 ` Alex Williamson
  2016-03-22  3:01 ` Peter Xu
  0 siblings, 2 replies; 13+ messages in thread
From: Bandan Das @ 2016-03-21 22:00 UTC (permalink / raw)
  To: qemu-devel, Alex Williamson


vfio_listener_region_add for a iommu mr results in
an overflow assert since emulated iommu memory region is initialized
with UINT64_MAX. Add a check just like memory_region_size()
does.

Signed-off-by: Bandan Das <bsd@redhat.com>
---
 hw/vfio/common.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index fb588d8..269244b 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -349,7 +349,12 @@ static void vfio_listener_region_add(MemoryListener *listener,
     if (int128_ge(int128_make64(iova), llend)) {
         return;
     }
-    end = int128_get64(llend);
+
+    if (int128_eq(llend, int128_2_64())) {
+            end = UINT64_MAX;
+    } else {
+            end = int128_get64(llend);
+    }
 
     if ((iova < container->min_iova) || ((end - 1) > container->max_iova)) {
         error_report("vfio: IOMMU container %p can't map guest IOVA region"
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-03-23  2:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-21 22:00 [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition Bandan Das
2016-03-21 22:34 ` Alex Williamson
2016-03-22  0:06   ` Bandan Das
2016-03-22  0:30     ` Alex Williamson
2016-03-22  1:54       ` Bandan Das
2016-03-22  2:16         ` Alex Williamson
2016-03-22 18:55           ` Bandan Das
2016-03-22 19:31             ` Alex Williamson
2016-03-22 20:55               ` Bandan Das
2016-03-22  3:01 ` Peter Xu
2016-03-22 19:07   ` Bandan Das
2016-03-22 19:31     ` Alex Williamson
2016-03-23  2:42     ` Peter Xu

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).