Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-22 Thread Peter Xu
On Tue, Mar 22, 2016 at 03:07:00PM -0400, Bandan Das wrote: > Thank you Peter, I wasn't aware. But unfortunately, I don't think he's doing > the right > thing either when handing @end ? Oh well, it's a RFC :) Possibly. Just to make sure you know about the whole thing (rather than only the @end f

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-22 Thread Bandan Das
Alex Williamson writes: ... >> >> And it does. If we fix this assert, then vfio_dma_map() attempts mapping >> this direct mapped address range starting from 0 and prints a >> warning message; happens for the whole range and goes on for ever. >> The overflow check seemed to me like something we s

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-22 Thread Alex Williamson
On Tue, 22 Mar 2016 15:07:00 -0400 Bandan Das wrote: > Peter Xu writes: > > > On Mon, Mar 21, 2016 at 06:00:50PM -0400, Bandan Das wrote: > >> > >> vfio_listener_region_add for a iommu mr results in > >> an overflow assert since emulated iommu memory region is initialized > >> with UINT64_MA

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-22 Thread Alex Williamson
On Tue, 22 Mar 2016 14:55:14 -0400 Bandan Das wrote: > Alex Williamson writes: > ... > >> >>mr->size = int128_make64(size); > >> >>if (size == UINT64_MAX) { > >> >> mr->size = int128_2_64(); > >> >>} > >> >> So, end - 1 is still valid for end = UINT64_MAX, no ? > >> > > >>

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-22 Thread Bandan Das
Peter Xu writes: > On Mon, Mar 21, 2016 at 06:00:50PM -0400, Bandan Das wrote: >> >> 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. > > Hi, Bandan,

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-22 Thread Bandan Das
Alex Williamson writes: ... >> >>mr->size = int128_make64(size); >> >>if (size == UINT64_MAX) { >> >> mr->size = int128_2_64(); >> >>} >> >> So, end - 1 is still valid for end = UINT64_MAX, no ? >> > >> > int128_2_64() is not equal to UINT64_MAX, so assigning UIN64_MAX to >> >

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Peter Xu
On Mon, Mar 21, 2016 at 06:00:50PM -0400, Bandan Das wrote: > > 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. Hi, Bandan, In case you missed this: ht

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Alex Williamson
On Mon, 21 Mar 2016 21:54:48 -0400 Bandan Das wrote: > Alex Williamson writes: > > > On Mon, 21 Mar 2016 20:06:32 -0400 > > Bandan Das wrote: > > > >> Alex Williamson writes: > >> > >> > On Mon, 21 Mar 2016 18:00:50 -0400 > >> > Bandan Das wrote: > >> > > >> >> vfio_listener_region_

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Bandan Das
Alex Williamson writes: > On Mon, 21 Mar 2016 20:06:32 -0400 > Bandan Das wrote: > >> Alex Williamson writes: >> >> > On Mon, 21 Mar 2016 18:00:50 -0400 >> > Bandan Das wrote: >> > >> >> vfio_listener_region_add for a iommu mr results in >> >> an overflow assert since emulated iommu memory

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Alex Williamson
On Mon, 21 Mar 2016 20:06:32 -0400 Bandan Das wrote: > Alex Williamson writes: > > > On Mon, 21 Mar 2016 18:00:50 -0400 > > Bandan Das wrote: > > > >> vfio_listener_region_add for a iommu mr results in > >> an overflow assert since emulated iommu memory region is initialized > >> with UINT64

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Bandan Das
Alex Williamson writes: > On Mon, 21 Mar 2016 18:00:50 -0400 > Bandan Das wrote: > >> 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-o

Re: [Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Alex Williamson
On Mon, 21 Mar 2016 18:00:50 -0400 Bandan Das wrote: > 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 > --- > hw/vfio/c

[Qemu-devel] [PATCH] vfio: add check for memory region overflow condition

2016-03-21 Thread Bandan Das
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 --- hw/vfio/common.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) d