Re: [PATCH v7 09/12] migration/dirtyrate: Implement set_sample_page_period() and get_sample_page_period()

2020-09-10 Thread Li Qiang
ool get_sample_page_period(int64_t sec) This function name may confuse people the this will get the period. But in fact you just check whether the 'period' is valid. I think it is better to name it to be 'is_sample_period_valid' or something meaningful. Thanks, Li Qiang > +{ > +

Re: [PATCH v7 06/12] migration/dirtyrate: Record hash results for each sampled page

2020-09-10 Thread Li Qiang
struct DirtyRateConfig config, > + int *block_index) > +{ > +struct RamblockDirtyInfo *info = NULL; > +struct RamblockDirtyInfo *dinfo = NULL; > +RAMBlock *block = NULL; > +int index = 0; > + > +RAMBLOCK_FO

Re: [PATCH] test-vmstate: remove unnecessary code in match_interval_mapping_node

2020-09-09 Thread Li Qiang
Pan Nengyuan 于2020年9月10日周四 上午10:39写道: > > 'str' is not used in match_interval_mapping_node(), remove it. > > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > tests/test-vmstate.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/tests/test-vmsta

Does. there exists race condition in virtio-gpu device

2020-09-09 Thread Li Qiang
ink there is a race condition. But I don't find a pattern for this kind of bug(BH and vcpu thread). I missed anything? Thanks, Li Qiang

Re: [RFC 1/4] memory: add memory_region_init_io_with_dev interface

2020-09-08 Thread Li Qiang
Gerd Hoffmann 于2020年9月9日周三 下午12:49写道: > > On Wed, Sep 09, 2020 at 10:15:47AM +0800, Jason Wang wrote: > > > > On 2020/9/9 上午12:41, Li Qiang wrote: > > > Currently the MR is not explicitly connecting with its device instead of > > > a opaque. In most

Re: [RFC 1/4] memory: add memory_region_init_io_with_dev interface

2020-09-08 Thread Li Qiang
Jason Wang 于2020年9月9日周三 上午10:16写道: > > > On 2020/9/9 上午12:41, Li Qiang wrote: > > Currently the MR is not explicitly connecting with its device instead of > > a opaque. In most situation this opaque is the deivce but it is not an > > enforcement. This patc

Re: [RFC 0/4] Add a 'in_mmio' device flag to avoid the DMA to MMIO

2020-09-08 Thread Li Qiang
Jason Wang 于2020年9月9日周三 上午10:17写道: > > > On 2020/9/9 上午12:41, Li Qiang wrote: > > Currently the qemu device fuzzer find some DMA to MMIO issue. If the > > device handling MMIO currently trigger a DMA which the address is MMIO, > > this will reenter the device MMIO han

[RFC 0/4] Add a 'in_mmio' device flag to avoid the DMA to MMIO

2020-09-08 Thread Li Qiang
this by adding a per-device flag 'in_mmio'. When the memory core dispatch MMIO it will check/set this flag and when it leaves it will clean this flag. Li Qiang (4): memory: add memory_region_init_io_with_dev interface memory: avoid reenter the device's MMIO handler while processing MMIO e1000e: use

[RFC 2/4] memory: avoid reenter the device's MMIO handler while processing MMIO

2020-09-08 Thread Li Qiang
This patch adds a 'in_mmio' flag to 'DeviceState' to indicate that the device is doing MMIO path. This can avoid the malicious guest do DMA to MMIO and crash the qemu. Signed-off-by: Li Qiang --- include/hw/qdev-core.h | 1 + softmmu/memory.c | 31 --- 2 files

[RFC 4/4] hcd-xhci: use the new memory_region_init_io_with_dev interface

2020-09-08 Thread Li Qiang
This can avoid the DMA to MMIO issue here: https://bugs.launchpad.net/qemu/+bug/1891354 Signed-off-by: Li Qiang --- hw/usb/hcd-xhci.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 46a2186d91

[RFC 3/4] e1000e: use the new memory_region_init_io_with_dev interface

2020-09-08 Thread Li Qiang
This can avoid the DMA to MMIO issue here: https://bugs.launchpad.net/qemu/+bug/1886362 Signed-off-by: Li Qiang --- hw/net/e1000e.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index fda34518c9..0aac5cea2e 100644 --- a/hw/net

[RFC 1/4] memory: add memory_region_init_io_with_dev interface

2020-09-08 Thread Li Qiang
Currently the MR is not explicitly connecting with its device instead of a opaque. In most situation this opaque is the deivce but it is not an enforcement. This patch adds a DeviceState member of to MemoryRegion we will use it in later patch. Signed-off-by: Li Qiang --- include/exec/memory.h

Re: [PATCH v2] virtio-mem: detach the element from the virtqueue when error occurs

2020-09-08 Thread Li Qiang
Michael S. Tsirkin 于2020年9月8日周二 下午10:10写道: > > For some reason I didn't receive the original email. > Sorry. > Queued now. > Kindly notice: Here is another patch for virtio-pmem. https://lists.gnu.org/archive/html/qemu-devel/2020-08/msg02639.html Thanks, Li Qiang > On Mon,

Re: [PATCH] hw: ide: check the pointer before do dma memory unmap

2020-09-06 Thread Li Qiang
Ping! Li Qiang 于2020年9月1日周二 下午6:34写道: > > Ping. > > Li Qiang 于2020年8月15日周六 下午3:21写道: > > > > In 'map_page' we need to check the return value of > > 'dma_memory_map' to ensure the we actully maped something. > > Otherwise, we will hit an assert in 'address_

Re: [PATCH v2] virtio-mem: detach the element from the virtqueue when error occurs

2020-09-06 Thread Li Qiang
Ping! Li Qiang 于2020年8月28日周五 上午9:21写道: > > Kindly ping. > > Li Qiang 于2020年8月16日周日 下午10:23写道: > > > > If error occurs while processing the virtio request we should call > > 'virtqueue_detach_element' to detach the element from the virtqueue > > before free

Re: [PATCH] hw: virtio-pmem: detach the element fromt the virtqueue when error occurs

2020-09-06 Thread Li Qiang
ping! Li Qiang 于2020年8月28日周五 上午9:21写道: > > Kindly ping. > > Li Qiang 于2020年8月14日周五 上午12:52写道: > > > > If error occurs while processing the virtio request we should call > > 'virtqueue_detach_element' to detach the element from the virtqueue > > before free

Re: elf2dmp: Fix memory leak on main() error paths

2020-09-06 Thread Li Qiang
AlexChen 于2020年8月26日周三 下午6:16写道: > > From: AlexChen Reviewed-by: Li Qiang > > The 'kdgb' is allocating memory in get_kdbg(), but it is not freed > in both fill_header() and fill_context() failed branches, fix it. > > Signed-off-by: AlexChen > --- > contrib/elf2dm

Re: [PATCH 12/13] dma: Let dma_memory_read/write() take MemTxAttrs argument

2020-09-06 Thread Li Qiang
t; - dma_memory_read(E1, E2, E3, E4) > + dma_memory_read(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) > | > - dma_memory_write(E1, E2, E3, E4) > + dma_memory_write(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) > ) > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by:

Re: [PATCH 13/13] dma: Let dma_memory_map() take MemTxAttrs argument

2020-09-06 Thread Li Qiang
3, E4) > + dma_memory_map(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/hw/pci/pci.h| 3 ++- > include/sysemu/dma.h| 5 +++-- > dma-helpers.c | 3 ++- > hw/display/vi

Re: [PATCH 11/13] dma: Let dma_memory_rw() take MemTxAttrs argument

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:53写道: > > Let devices specify transaction attributes when calling > dma_memory_rw(). > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/hw/pci/pci.h | 3 ++- > include/sysemu/dma.h | 11

Re: [PATCH 10/13] dma: Let dma_memory_rw_relaxed() take MemTxAttrs argument

2020-09-06 Thread Li Qiang
> > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/sysemu/dma.h | 15 ++- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h > index d0381f9ae9b..59331ec0bd3 100644 > --- a/i

Re: [PATCH 09/13] dma: Let dma_memory_set() take MemTxAttrs argument

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:49写道: > > Let devices specify transaction attributes when calling > dma_memory_set(). > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/hw/ppc/spapr_vio.h | 3 ++- > include/sysemu/dma.h

Re: [PATCH 08/13] dma: Let dma_memory_valid() take MemTxAttrs argument

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:48写道: > > Let devices specify transaction attributes when calling > dma_memory_valid(). > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/hw/ppc/spapr_vio.h | 2 +- > include/sysemu/dma.h | 4

Re: [PATCH 07/13] dma: Let dma_memory_write() propagate MemTxResult

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:46写道: > > dma_memory_rw_relaxed() returns a MemTxResult type. > Do not discard it, return it to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/sysemu/dma.h | 22 ++

Re: [PATCH 06/13] dma: Let dma_memory_read() propagate MemTxResult

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:50写道: > > dma_memory_rw_relaxed() returns a MemTxResult type. > Do not discard it, return it to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/sysemu/dma.h | 21 +

Re: [PATCH 05/13] dma: Let dma_memory_rw() propagate MemTxResult

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:46写道: > > address_space_rw() returns a MemTxResult type. > Do not discard it, return it to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/sysemu/dma.h | 30 ++-

Re: [PATCH 04/13] dma: Let dma_memory_set() propagate MemTxResult

2020-09-06 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月4日周五 下午11:47写道: > > address_space_write() returns a MemTxResult type. > Do not discard it, return it to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/sysemu/dma.h | 15 ++- > d

Re: [PATCH 01/13] pci: pass along the return value of dma_memory_rw

2020-09-06 Thread Li Qiang
gt; safe. > > Signed-off-by: Klaus Jensen > Reviewed-by: Philippe Mathieu-Daudé > Reviewed-by: Michael S. Tsirkin > Acked-by: Keith Busch > Message-Id: <20191011070141.188713-2-...@irrelevant.dk> > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --

Re: [PATCH 3/3] pci: Let pci_dma_write() propagate MemTxResult

2020-09-04 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月5日周六 上午12:26写道: > > pci_dma_rw() returns a MemTxResult type. > Do not discard it, return it to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/hw/pci/pci.h | 16 ++-- > 1 file chan

Re: [PATCH 2/3] pci: Let pci_dma_read() propagate MemTxResult

2020-09-04 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年9月5日周六 上午12:27写道: > > pci_dma_rw() returns a MemTxResult type. > Do not discard it, return it to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > include/hw/pci/pci.h | 16 ++-- > 1 file chan

Re: [PATCH 1/3] pci: Let pci_dma_rw() propagate MemTxResult

2020-09-04 Thread Li Qiang
DMADirection dir) > { > return dma_memory_rw(pci_get_address_space(dev), addr, buf, len, > dir, MEMTXATTRS_UNSPECIFIED); Reviewed-by: Li Qiang > -- > 2.26.2 > >

Re: [RFC PATCH 00/12] hw: Forbid DMA write accesses to MMIO regions

2020-09-04 Thread Li Qiang
der the no-PCI the qemu_irq cases. I agree to address the PCI cases first. Thanks, Li Qiang > Regards, > > Phil. > > Klaus Jensen (1): > pci: pass along the return value of dma_memory_rw > > Philippe Mathieu-Daudé (11): > dma: Let dma_memory_valid() take MemTxAttrs argum

Re: [PATCH 2/2] hw/net/e1000e: Remove duplicated write handler for FLSWDATA register

2020-09-04 Thread Li Qiang
0e_macreg_writeops[] = { > > 3102 e1000e_putreg(FLSWDATA), > > 3145 e1000e_putreg(FLSWDATA), > > To avoid confusion, remove the duplicated initialization. > > Fixes: 6f3fbe4ed0 ("net: Introduce e1000e device emulation") > Signed

Re: [PATCH 1/2] hw/net/e1000e: Remove overwritten read handler for STATUS register

2020-09-04 Thread Li Qiang
ation. > > 6f3fbe4ed0 ("net: Introduce e1000e device emulation") > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > hw/net/e1000e_core.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c >

Re: [PATCH] net/filter-rewriter: destroy g_hash_table in colo_rewriter_cleanup

2020-09-04 Thread Li Qiang
Pan Nengyuan 于2020年9月4日周五 下午3:23写道: > > s->connection_track_table forgot to destroy in colo_rewriter_cleanup. Fix it. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > net/filter-rewriter.c | 2 ++ > 1 file changed, 2 inserti

Re: [RFC 0/3] try to solve the DMA to MMIO issue

2020-09-03 Thread Li Qiang
Peter Maydell 于2020年9月3日周四 下午7:19写道: > > On Thu, 3 Sep 2020 at 12:11, Li Qiang wrote: > > > > Peter Maydell 于2020年9月3日周四 下午6:53写道: > > > > > > On Thu, 3 Sep 2020 at 04:55, Jason Wang wrote: > > > > I think we still need to seek a way to address

Re: [RFC 0/3] try to solve the DMA to MMIO issue

2020-09-03 Thread Li Qiang
? This is special case I think. > Now we have reentered into device A's code > > That is to say, the problem is general to "device A does > something that affects device B" links of all kinds, which As the P2P is a normal behavior, we can't just prevent this. Thanks, Li Qiang

Re: [RFC 3/3] virtio-gpu: make the IO handler reentrant

2020-09-03 Thread Li Qiang
Michael Tokarev 于2020年9月3日周四 下午1:12写道: > > 02.09.2020 19:22, Li Qiang wrote: > .. > > @@ -809,6 +809,10 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) > > { > > struct virtio_gpu_ctrl_command *cmd; > > > > +if (atomic_read(>in_io)) { > >

Re: [RFC 0/3] try to solve the DMA to MMIO issue

2020-09-03 Thread Li Qiang
Jason Wang 于2020年9月3日周四 下午2:16写道: > > > On 2020/9/3 下午12:50, Li Qiang wrote: > > Jason Wang 于2020年9月3日周四 下午12:24写道: > >> > >> On 2020/9/3 下午12:06, Alexander Bulekov wrote: > >>> On 200903 1154, Jason Wang wrote: > >>>> On 2020/9/3 上午12:

Re: [RFC 0/3] try to solve the DMA to MMIO issue

2020-09-02 Thread Li Qiang
Jason Wang 于2020年9月3日周四 下午12:24写道: > > > On 2020/9/3 下午12:06, Alexander Bulekov wrote: > > On 200903 1154, Jason Wang wrote: > >> On 2020/9/3 上午12:22, Li Qiang wrote: > >>> The qemu device fuzzer has found several DMA to MMIO issue. > >>> The

[RFC 1/3] e1000e: make the IO handler reentrant

2020-09-02 Thread Li Qiang
t/qemu/+bug/1886362 Reported-by: Alexander Bulekov Signed-off-by: Li Qiang --- hw/net/e1000e.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index fda34518c9..eb6b34b7f3 100644 --- a/hw/net/e1000e.c ++

[RFC 2/3] xhci: make the IO handler reentrant

2020-09-02 Thread Li Qiang
891354 Reported-by: Alexander Bulekov Signed-off-by: Li Qiang --- hw/usb/hcd-xhci.c | 60 +++ hw/usb/hcd-xhci.h | 1 + 2 files changed, 61 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 46a2186d91..06cd235123 100644 --- a/hw/u

[RFC 3/3] virtio-gpu: make the IO handler reentrant

2020-09-02 Thread Li Qiang
n a BH which in the main thread and 'virtio_gpu_reset' is run in the vcpu thread and both of them access the 'g->cmdq'. Buglink: https://bugs.launchpad.net/qemu/+bug/1888606 Reported-by: Alexander Bulekov Signed-off-by: Li Qiang --- hw/display/virtio-gpu.c| 10 ++ include/

[RFC 0/3] try to solve the DMA to MMIO issue

2020-09-02 Thread Li Qiang
/clean according the per-device's IO emulation. The second issue which itself suffers a race condition so I uses a atomic. Li Qiang (3): e1000e: make the IO handler reentrant xhci: make the IO handler reentrant virtio-gpu: make the IO handler reentrant hw/display/virtio-gpu.c| 10

Re: [PATCH v2] cirrus: handle wraparound in cirrus_invalidate_region

2020-09-01 Thread Li Qiang
g/1880189 > Cc: Li Qiang > Reported-by: Philippe Mathieu-Daudé > Signed-off-by: Gerd Hoffmann > Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > hw/display/cirrus_vga.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff

Re: [PATCH v2 09/10] block/file-posix: fix a possible undefined behavior

2020-09-01 Thread Li Qiang
gt; Reviewed-by: Stefano Garzarella Reviewed-by: Li Qiang > --- > Cc: Kevin Wolf > Cc: Max Reitz > Cc: Aarushi Mehta > Cc: qemu-bl...@nongnu.org > --- > - V2: no changes in v2. > --- > block/file-posix.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) &g

Re: [PATCH v2 07/10] migration/colo: Plug memleaks in colo_process_incoming_thread

2020-09-01 Thread Li Qiang
Pan Nengyuan 于2020年8月31日周一 下午3:17写道: > > 'local_err' forgot to free in colo_process_incoming_thread error path. > Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Hailiang Zhang > Cc: Juan Quintela &g

Re: [PATCH] hw: ide: check the pointer before do dma memory unmap

2020-09-01 Thread Li Qiang
Ping. Li Qiang 于2020年8月15日周六 下午3:21写道: > > In 'map_page' we need to check the return value of > 'dma_memory_map' to ensure the we actully maped something. > Otherwise, we will hit an assert in 'address_space_unmap'. > This is because we can't find the MR with the NULL buffer. &

Re: [PATCH] usb: call usb_packet_cleanup on usb_packet_map failure

2020-09-01 Thread Li Qiang
!= 0); Hi Gerd, ’usb_packet_setup‘ doesn't modify the 'iov' and other resources. 'usb_packet_cleanup' is paired with 'usb_packet_init' which I think should be processed in the more up layer. If 'usb_packet_map' fails, we need to clean the 'iov' in 'usb_packet_map' itself.

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-09-01 Thread Li Qiang
: > > > > "off_cur_end = ((off_cur + bytesperline - 1) & s->cirrus_addr_mask) + 1;" > > > This addition '1' is what I think should be substracted in wrapped cases. > > The +1 balances the -1 done before ... Then the second set size is ok. Thanks, Li Qiang > > take care, > Gerd >

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-09-01 Thread Li Qiang
irty(>vga.vram, 0, off_cur_end); For the 'off_cur_end' here, why we add 1 at the first?: "off_cur_end = ((off_cur + bytesperline - 1) & s->cirrus_addr_mask) + 1;" This addition '1' is what I think should be substracted in wrapped cases. Thanks, Li Qiang +} off_begin += off_pitch; } } > > take care, > Gerd >

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-31 Thread Li Qiang
es. In fact we need to set 0x1000 bytes. > > > > +memory_region_set_dirty(>vga.vram, 0, off_cur_end); > > > > And here be 'off_cur_end -1' > > --verbose please. I think this one is correct. Here the 'off_cur_end' is size. In this second set we actually sets 'off_cur_end+1' size bytes. In a word, I think the first lost a byte and the second added a more byte . Thank,s Li Qiang > > take care, > Gerd >

Re: [PATCH] util/vfio-helpers: Unify trace-events size format

2020-08-28 Thread Li Qiang
00 > temporary 0 iova (nil) > qemu_vfio_find_mapping s 0xf1c60d90 host 0x2bc0 > qemu_vfio_new_mapping s 0xf1c60d90 host 0x2bc0 size 0x400 > index 4 iova 0x114000 > qemu_vfio_do_mapping s 0xf1c60d90 host 0x2bc0 size 0x400 > iova

Re: [PATCH v2 1/2] util/hexdump: Convert to take a void pointer argument

2020-08-28 Thread Li Qiang
hieu-Daudé Reviewed-by: Li Qiang > --- > Since v1: > - renamed argument 'bufptr' (Peter Maydell) > --- > include/qemu-common.h| 3 ++- > hw/dma/xlnx_dpdma.c | 2 +- > hw/net/fsl_etsec/etsec.c | 2 +- > hw/sd/sd.c | 2 +- > hw/usb/redirect.c

Re: [PATCH] hw: virtio-pmem: detach the element fromt the virtqueue when error occurs

2020-08-27 Thread Li Qiang
Kindly ping. Li Qiang 于2020年8月14日周五 上午12:52写道: > > If error occurs while processing the virtio request we should call > 'virtqueue_detach_element' to detach the element from the virtqueue > before free the elem. > > Signed-off-by: Li Qiang > --- > hw/virtio/virti

Re: [PATCH v2] virtio-mem: detach the element from the virtqueue when error occurs

2020-08-27 Thread Li Qiang
Kindly ping. Li Qiang 于2020年8月16日周日 下午10:23写道: > > If error occurs while processing the virtio request we should call > 'virtqueue_detach_element' to detach the element from the virtqueue > before free the elem. > > Signed-off-by: Li Qiang > --- > Change since v1: >

Re: [PATCH 06/12] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()

2020-08-27 Thread Li Qiang
Pan Nengyuan 于2020年8月27日周四 下午3:06写道: > > > > On 2020/8/26 20:20, Li Qiang wrote: > > Pan Nengyuan 于2020年8月14日周五 下午6:15写道: > >> > >> Receiving error in local variable err, and forgot to free it. > >> Considering that there is no place to deal with it.

Re: [PATCH 8/8] dc390: Use TYPE_DC390_DEVICE constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:44写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: Paolo Bonzini > Cc: Fam Zheng > Cc: qemu-devel@nongnu.org > --- > hw/scsi/esp-pci

Re: [PATCH 6/8] tosa: Use TYPE_TOSA_MISC_GPIO constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:50写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: Andrzej Zaborowski > Cc: Peter Maydell > Cc: qemu-...@nongnu.org > Cc: qemu-devel

Re: [PATCH 7/8] ppce500: Use TYPE_PPC_E500_PCI_BRIDGE constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:51写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: David Gibson > Cc: qemu-...@nongnu.org > Cc: qemu-devel@nongnu.org > --- > hw/pci-h

Re: [PATCH 3/8] amd_iommu: Use TYPE_AMD_IOMMU_PCI constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:48写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: "Michael S. Tsirkin" > Cc: Marcel Apfelbaum > Cc: Paolo Bonzini > Cc: Ric

Re: [PATCH 5/8] xlnx-zcu102: Use TYPE_ZCU102_MACHINE constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:47写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: Alistair Francis > Cc: "Edgar E. Iglesias" > Cc: Peter Maydell > Cc:

Re: [PATCH 1/8] etsec: Use TYPE_ETSEC_COMMON constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:46写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: David Gibson > Cc: Jason Wang > Cc: qemu-...@nongnu.org > Cc: qemu-devel@nongnu.or

Re: [PATCH 4/8] sclpconsole: Use TYPE_* constants

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:45写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: Cornelia Huck > Cc: Halil Pasic > Cc: Christian Borntraeger > Cc: Thomas Huth >

Re: [PATCH 2/8] nios2_iic: Use TYPE_ALTERA_IIC constant

2020-08-26 Thread Li Qiang
Eduardo Habkost 于2020年8月27日周四 上午2:44写道: > > This will make future conversion to use OBJECT_DECLARE* easier. > > Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang > --- > Cc: Chris Wulff > Cc: Marek Vasut > Cc: qemu-devel@nongnu.org > --- > hw/intc/nios2_iic

Re: [PATCH v2] virtio-gpu: fix unmap the already mapped items

2020-08-26 Thread Li Qiang
ase) { > +i++; /* cleanup the 'i'th map */ Should we also reset (*iov)[i].iov_len to 'len' so the dma_memory_unmap has the right size? Thanks, Li Qiang > +} > virtio_gpu_cleanup_mapping_iov(g, *iov, i); > g_free(ents); > *iov = NULL; > -- > 2.17.1 > > > >

Re: [PATCH 08/12] migration/colo: Plug memleaks in colo_process_incoming_thread

2020-08-26 Thread Li Qiang
read(void *opaque) > colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_READY, >_err); > if (local_err) { > +error_report_err(local_err); > goto out; > } > Could we arrange 'error_report_err' in 'out' label? Like this: if (local_err) { error_report_err(local_err); } Thanks, Li Qiang > -- > 2.18.2 > >

Re: [PATCH 07/12] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:38写道: > > 'err' forgot to free in x86_cpu_class_check_missing_features error path. > Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Paolo Bonzini > Cc: Richard Hende

Re: [PATCH 06/12] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()

2020-08-26 Thread Li Qiang
> params->minor_ver); > -gdk_gl_context_realize(ctx, ); > +gdk_gl_context_realize(ctx, NULL); > return ctx; > } Maybe we should check the return value of 'gdk_window_create_gl_context' and 'gdk_gl_context_realize' instead of omitting it? Thanks, Li Qiang > > -- > 2.18.2 > >

Re: [PATCH 01/12] qga/channel-posix: Plug memory leak in ga_channel_write_all()

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:30写道: > > Missing g_error_free on error path in ga_channel_write_all(). Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Michael Roth > --- > qga/channel-posix.c | 6 +- >

Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()

2020-08-26 Thread Li Qiang
Cornelia Huck 于2020年8月26日周三 下午7:41写道: > > On Wed, 26 Aug 2020 19:03:37 +0800 > Li Qiang wrote: > > > Pan Nengyuan 于2020年8月14日周五 下午6:29写道: > > > > > > Missing g_error_free() in vfio_ap_get_group() error path. Fix that. > > > > > > Repor

Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:29写道: > > Missing g_error_free() in vfio_ap_get_group() error path. Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang I see Cornelia Huck has merged this in his tree. Don't know whether this series w

Re: [PATCH 03/12] elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:28写道: > > Missing g_error_free in QEMU_Elf_init() error path. Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Viktor Prutyanov > --- > contrib/elf2dmp/qemu_elf.c | 1 + >

Re: [PATCH 05/12] target/i386/sev: Plug memleak in sev_read_file_base64

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:37写道: > > Missing g_error_free() in sev_read_file_base64() error path. > Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Paolo Bonzini > Cc: Richard Henderson > Cc: Eduardo

Re: [PATCH 04/12] elf2dmp/pdb: Plug memleak in pdb_init_from_file

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:51写道: > > Missing g_error_free in pdb_init_from_file() error path. Fix that. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Viktor Prutyanov > --- > contrib/elf2dmp/pdb.c | 1 + >

Re: [PATCH 09/12] blockdev: Fix a memleak in drive_backup_prepare()

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:54写道: > > 'local_err' seems forgot to propagate in error path, it'll cause > a memleak. Fix it. > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang > --- > Cc: Kevin Wolf > Cc: Max Reitz > Cc: Ma

Re: [PATCH 10/12] block/file-posix: fix a possible undefined behavior

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:32写道: > > local_err is not initialized to NULL, it will cause a assert error as below: > qemu/util/error.c:59: error_setv: Assertion `*errp == NULL' failed. > > Fixes: c6447510690 > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan

Re: [PATCH 11/12] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string

2020-08-26 Thread Li Qiang
Pan Nengyuan 于2020年8月14日周五 下午6:40写道: > > 'addr' forgot to free in vnc_socket_ip_addr_string error path. Fix that. s/forgot/is forgot, I think the maintainer will do this minor adjustment. . > > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang &

Re: [PATCH v2 05/10] hw/virtio/vhost-user:Remove dead assignment in scrub_shadow_regions()

2020-08-26 Thread Li Qiang
;userspace_addr, , ); > ^~ > > Reported-by: Euler Robot > Signed-off-by: Chen Qun > Reviewed-by: Raphael Norwitz Reviewed-by: Li Qiang > --- > Cc: "Michael S. Tsirkin" > Cc: Raphael Norwitz > --- > hw/virtio/vhost-user.c | 2 +- > 1 file changed, 1 insertion(+),

Re: [PATCH v2 07/10] vfio/platform: Remove dead assignment in vfio_intp_interrupt()

2020-08-26 Thread Li Qiang
o/platform.c > > > +++ b/hw/vfio/platform.c > > > @@ -236,7 +236,7 @@ static void vfio_intp_interrupt(VFIOINTp *intp) > > > trace_vfio_intp_interrupt_set_pending(intp->pin); > > > QSIMPLEQ_INSERT_TAIL(>pending_intp_queue, > > >

Re: [PATCH v2 10/10] hw/display/vga:Remove redundant statement in vga_draw_graphic()

2020-08-25 Thread Li Qiang
Qun > Reviewed-by: Gerd Hoffmann Reviewed-by: Li Qiang > --- > Cc: Gerd Hoffmann > --- > hw/display/vga.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/hw/display/vga.c b/hw/display/vga.c > index 061fd9ab8f..836ad50c7b 100644 > --- a/hw/display/vga.c > +

Re: [PATCH v2 07/10] vfio/platform: Remove dead assignment in vfio_intp_interrupt()

2020-08-25 Thread Li Qiang
_INSERT_TAIL(>pending_intp_queue, > intp, pqnext); > -ret = event_notifier_test_and_clear(intp->interrupt); Shouldn't we check the 'ret' like the other place in this function? Thanks, Li Qiang > +event_notifier_test_and_clear(intp->interrupt); > return; > } > > -- > 2.23.0 > >

Re: [PATCH v2 06/10] hw/net/virtio-net:Remove redundant statement in virtio_net_rsc_tcp_ctrl_check()

2020-08-25 Thread Li Qiang
0x3F'. The last ‘tcp_flag’ assignment statement > is > the same as that of the first two statements. > > Reported-by: Euler Robot > Signed-off-by: Chen Qun > Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > Cc: "Michael S. Tsirkin" > Cc: Ja

Re: [PATCH v2 02/10] hw/arm/omap1:Remove redundant statement in omap_clkdsp_read()

2020-08-25 Thread Li Qiang
obot > Signed-off-by: Chen Qun Reviewed-by: Li Qiang > --- > Cc: Peter Maydell > Cc: qemu-...@nongnu.org > --- > hw/arm/omap1.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c > index 6ba0df6b6d..02c0f66431 100644 > ---

Re: [PATCH v2 01/10] hw/arm/virt-acpi-build:Remove dead assignment in build_madt()

2020-08-25 Thread Li Qiang
orted-by: Euler Robot > Signed-off-by: Chen Qun > Reviewed-by: Igor Mammedov Reviewed-by: Li Qiang > --- > Cc: Shannon Zhao > Cc: Peter Maydell > Cc: "Michael S. Tsirkin" > Cc: Igor Mammedov > Cc: qemu-...@nongnu.org > --- > hw/arm/virt-acpi-b

Re: [PATCH] usb: fix setup_len init (CVE-2020-14364)

2020-08-24 Thread Li Qiang
rom working with invalid USBDevice->setup_len values and overrunning > the USBDevice->setup_buf[] buffer. > > Fixes: CVE-2020-14364 > Signed-off-by: Gerd Hoffmann > Tested-by: Gonglei Reviewed-by: Li Qiang Just see the page. -->https://access.redhat.com/security/cve/CVE-2

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-21 Thread Li Qiang
k - off_cur); Should here be 's->cirrus_addr_mask + 1 - off_cur' > +memory_region_set_dirty(>vga.vram, 0, off_cur_end); And here be 'off_cur_end -1' Thanks, Li Qiang > +} > off_begin += off_pitch; > } > } > -- > 2.27.0 > >

Re: [PATCH] qtest: add fuzz test case

2020-08-20 Thread Li Qiang
Thomas Huth 于2020年8月20日周四 下午10:24写道: > > On 19/08/2020 16.15, Li Qiang wrote: > > Currently the device fuzzer find a more and more issues. > > For every fuzz case, we need not only the fixes but also > > the coressponding test case. We can analysis the reproducer > >

[PATCH] hw: cirrus_vga: mask 'off_begin' in cirrus_invalidate_region()

2020-08-20 Thread Li Qiang
outl 0x03cc 0xe23f40e outl 0x03cc 0xe31dc12 outb 0x03cc 0x2f outl 0x03cc 0xe23f40e outl 0x03cc 0xe31dc12 outb 0x03cc 0x2f outl 0x03cc 0x1021f40e EOF This patch fixes this. Buglink: https://bugs.launchpad.net/qemu/+bug/1880189 Reported-by: Alexander Bulekov Signed-off-by: Li Qiang ---

Re: [PATCH] virtio: vdpa: omit check return of g_malloc

2020-08-19 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年8月19日周三 下午11:07写道: > > On 8/19/20 4:43 PM, Li Qiang wrote: > > If g_malloc fails, the application will be terminated. > > Which we don't want... better to use g_try_malloc() instead? I don't think so. If g_malloc return NULL it means a critical

Re: [PATCH] qtest: add fuzz test case

2020-08-19 Thread Li Qiang
Alexander Bulekov 于2020年8月20日周四 上午12:23写道: > > On 200819 2250, Li Qiang wrote: > > Philippe Mathieu-Daudé 于2020年8月19日周三 下午10:38写道: > > > > > On 8/19/20 4:15 PM, Li Qiang wrote: > > > > Currently the device fuzzer find a more and more issues. > &

Re: [PATCH] qtest: add fuzz test case

2020-08-19 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年8月19日周三 下午10:38写道: > On 8/19/20 4:15 PM, Li Qiang wrote: > > Currently the device fuzzer find a more and more issues. > > For every fuzz case, we need not only the fixes but also > > the coressponding test case. We can analysis the reproducer &g

[PATCH] virtio: vdpa: omit check return of g_malloc

2020-08-19 Thread Li Qiang
If g_malloc fails, the application will be terminated. No need to check the return value of g_malloc. Signed-off-by: Li Qiang --- hw/virtio/vhost-vdpa.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 4580f3efd8

[PATCH] qtest: add fuzz test case

2020-08-19 Thread Li Qiang
the issue LP#1878263 test case. Signed-off-by: Li Qiang --- tests/qtest/Makefile.include | 2 ++ tests/qtest/fuzz-test.c | 45 2 files changed, 47 insertions(+) create mode 100644 tests/qtest/fuzz-test.c diff --git a/tests/qtest/Makefile.include b/tests

Re: [PATCH 0/2] Fix the assert failure in scsi_dma_complete

2020-08-17 Thread Li Qiang
Paolo Bonzini 于2020年8月18日周二 上午1:05写道: > On 15/08/20 16:19, Li Qiang wrote: > > Currently in 'megasas_map_sgl' when 'iov_count=0' will just return > > success however the 'cmd' doens't contain any iov. This will cause > > the assert in 'scsi_dma_complete' fa

[PATCH v2] virtio-mem: detach the element from the virtqueue when error occurs

2020-08-16 Thread Li Qiang
If error occurs while processing the virtio request we should call 'virtqueue_detach_element' to detach the element from the virtqueue before free the elem. Signed-off-by: Li Qiang --- Change since v1: Change the subject Avoid using the goto label hw/virtio/virtio-mem.c | 3 +++ 1 file changed

Re: [PATCH 3/3] virtio-crypto: don't modify elem->in/out_sg

2020-08-16 Thread Li Qiang
API could be used instead (with better > performance) but requires careful auditing of the code, so do the simple > thing instead. > > Signed-off-by: Stefan Hajnoczi > virtio-net also uses this method. Reviewed-by: Li Qiang > --- > hw/virtio/virtio-crypto.c | 17 ++---

Re: [PATCH 1/3] util/iov: add iov_discard_undo()

2020-08-16 Thread Li Qiang
*undo->modified_iov = undo->orig; > +} > +} > + > +size_t iov_discard_front_undoable(struct iovec **iov, > + unsigned int *iov_cnt, > + size_t bytes, > + IOVDisca

Re: [PATCH 6/7] hw/ide/pci: Replace magic '512' value by BDRV_SECTOR_SIZE

2020-08-15 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年8月14日周五 下午4:33写道: > > Use self-explicit definitions instead of magic '512' value. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Li Qiang > --- > hw/ide/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --

Re: [PATCH 1/7] block/null: Make more explicit the driver default size is 1GiB

2020-08-15 Thread Li Qiang
Philippe Mathieu-Daudé 于2020年8月14日周五 下午4:29写道: > > As it is not obvious the default size for the null block driver > is 1 GiB, replace the obfuscated '1 << 30' magic value by a > definition using IEC binary prefixes. > > Signed-off-by: Philippe Mathieu-Daudé

<    1   2   3   4   5   6   7   8   9   >