222 Commits

Author SHA1 Message Date
Chen Qun
3336d8481a block-backend: Add device specific retry callback
Add retry_request_cb in BlockDevOps to do device specific retry action.
Backend's timer would be registered only when the backend is set 'retry'
on errors and the device supports retry action.

Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
2021-04-25 19:01:21 +08:00
Chen Qun
2248e4c884 block-backend: Introduce retry timer
Add a timer to regularly trigger retry on errors.

Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
2021-04-25 19:01:21 +08:00
Chen Qun
5184fd2f02 qapi/block-core: Add retry option for error action
Add a new error action 'retry' to support retry on errors.

Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
2021-04-25 19:01:21 +08:00
Chen Qun
f165da2d05 scsi-disk: Add support for retry on errors
Mark failed requests as to be retried and implement retry_request_cb to
handle these requests.

Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
2021-04-25 19:01:21 +08:00
Chen Qun
07ed5a03ec scsi-bus: Refactor the code that retries requests
Move the code that retries requests from scsi_dma_restart_bh() to its own,
non-static, function. This will allow us to call it from the
retry_request_cb() of scsi-disk in a future patch.

Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
2021-04-25 19:01:21 +08:00
openeuler-ci-bot
bde7331b41 !246 更新包依赖
From: @yangming73
Reviewed-by: @zhanghailiang_lucky
Signed-off-by: @zhanghailiang_lucky
2021-04-25 15:14:24 +08:00
Ming Yang
b39041a629 Merge branch 'openEuler-20.03-LTS-Next' of gitee.com:src-openeuler/qemu into yangming-rbd-20.03-next-v1 2021-04-25 10:33:29 +08:00
openeuler-ci-bot
d439c66cb4 !251 Revert migration feature
From: @Chuan-Zheng
Reviewed-by: @zhanghailiang_lucky
Signed-off-by: @zhanghailiang_lucky
2021-04-19 10:36:02 +08:00
Chuan Zheng
0d8a7eb3ab Revert "migration/dirtyrate: add migration dirtyrate feature"
This reverts commit 31dcda4fc76a2079da58ace9f2c502c065eda1fd.
2021-04-19 09:58:03 +08:00
Chuan Zheng
70ead7ca97 Revert "multifd/tls: add support for multifd tls feature"
This reverts commit 7c511d7e1ffa9376fd98d1d4916287eb787e21b9.
2021-04-19 09:57:40 +08:00
openeuler-ci-bot
22d11ce60d !250 Add Multifd support for TLS migration
From: @Chuan-Zheng
Reviewed-by: @zhanghailiang_lucky
Signed-off-by: @zhanghailiang_lucky
2021-04-17 17:07:32 +08:00
Ming Yang
01ed8a90f1 Merge branch 'openEuler-20.03-LTS-Next' of gitee.com:src-openeuler/qemu into yangming-rbd-20.03-next-v1 2021-04-17 16:57:00 +08:00
ChuanZheng
7c511d7e1f multifd/tls: add support for multifd tls feature
tls migration can easily reach bottleneck of cpu which results in
migration failure.
add support for multifd tls feature to make fully use of bandwidth.
2021-04-17 16:43:05 +08:00
openeuler-ci-bot
5772a1a3d4 !249 A Method for evaluating dirty page rate
From: @Chuan-Zheng
Reviewed-by: @zhanghailiang_lucky
Signed-off-by: @zhanghailiang_lucky
2021-04-17 16:00:22 +08:00
Chuan Zheng
31dcda4fc7 migration/dirtyrate: add migration dirtyrate feature
dirtyrate feature provides a method for calcluting dirty
page rate before migration.

Test dirtyrate by qmp command like this:
1. virsh qemu-monitor-command [vmname] '{"execute":"calc-dirty-rate", "arguments": {"calc-time": [sleep-time]}}'
2. sleep specific time which is a bit larger than sleep-time
3. virsh qemu-monitor-command [vmname] '{"execute":"query-dirty-rate"}'
2021-04-17 15:41:25 +08:00
Ming Yang
008c87949f Add block-rbd block-ssh and block-iscsi packages.
Signed-off-by: Ming Yang <yangming73@huawei.com>
2021-04-16 09:12:25 +00:00
openeuler-ci-bot
1888b25440 !237 Automatically generate code patches with openeuler !85
From: @kuhnchen18
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2021-03-18 22:08:06 +08:00
Chen Qun
975b491b36 spec: Update release version with !85
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-03-18 22:02:22 +08:00
Chen Qun
91aea89496 spec: Update patch and changelog with !85 fix CVE-2021-20203 #I3A34O !85
net: vmxnet3: validate configuration values during activate (CVE-2021-20203)

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-03-18 22:02:10 +08:00
Chen Qun
ad2227f9a2 net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
fix CVE-2021-20203 #I3A34O

While activating device in vmxnet3_acticate_device(), it does not
validate guest supplied configuration values against predefined
minimum - maximum limits. This may lead to integer overflow or
OOB access issues. Add checks to avoid it.

Fixes: CVE-2021-20203
Buglink: https://bugs.launchpad.net/qemu/+bug/1913873
Reported-by: Gaoning Pan <pgn@zju.edu.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-03-18 22:02:10 +08:00
openeuler-ci-bot
1375b06271 !207 Automatically generate code patches with openeuler !75
From: @zhendongchen
Reviewed-by: @yorifang,@yorifang,@yorifang
Signed-off-by: @yorifang,@yorifang,@yorifang
2021-02-27 14:53:47 +08:00
Euler Robot
b6ea3e737f spec: Update release version with !75
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2021-02-26 16:28:26 +08:00
Euler Robot
918f84359b spec: Update patch and changelog with !75
ide:atapi: check io_buffer_index in ide_atapi_cmd_reply_end

Signed-off-by: Alex Chen <alex.chen@huawei.com>
2021-02-26 16:27:54 +08:00
Huawei Technologies Co., Ltd
d2b7c174c0 ide:atapi: check io_buffer_index in ide_atapi_cmd_reply_end
Fix CVE-2020-29443

During data transfer via packet command in 'ide_atapi_cmd_reply_end'
's->io_buffer_index' could exceed the 's->io_buffer' length, leading
to OOB access issue. Add check to avoid it.
 ...
 #9  ahci_pio_transfer ../hw/ide/ahci.c:1383
 #10 ide_transfer_start_norecurse ../hw/ide/core.c:553
 #11 ide_atapi_cmd_reply_end ../hw/ide/atapi.c:284
 #12 ide_atapi_cmd_read_pio ../hw/ide/atapi.c:329
 #13 ide_atapi_cmd_read ../hw/ide/atapi.c:442
 #14 cmd_read ../hw/ide/atapi.c:988
 #15 ide_atapi_cmd ../hw/ide/atapi.c:1352
 #16 ide_transfer_start ../hw/ide/core.c:561
 #17 cmd_packet ../hw/ide/core.c:1729
 #18 ide_exec_cmd ../hw/ide/core.c:2107
 #19 handle_reg_h2d_fis ../hw/ide/ahci.c:1267
 #20 handle_cmd ../hw/ide/ahci.c:1318
 #21 check_cmd ../hw/ide/ahci.c:592
 #22 ahci_port_write ../hw/ide/ahci.c:373
 #23 ahci_mem_write ../hw/ide/ahci.c:513

Reported-by: Wenxiang Qian <leonwxqian@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-02-26 16:27:54 +08:00
openeuler-ci-bot
4d5aeb28d7 !202 Automatically generate code patches with openeuler !72
From: @zhendongchen
Reviewed-by: @yorifang,@yorifang
Signed-off-by: @yorifang,@yorifang
2021-02-24 15:22:16 +08:00
Euler Robot
c31379c458 spec: Update release version with !72
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2021-02-19 21:28:38 +08:00
Euler Robot
e540b82f51 spec: Update patch and changelog with !72
ati: use vga_read_byte in ati_cursor_define
sd: sdhci: assert data_count is within fifo_buffer
msix: add valid.accepts methods to check address

Signed-off-by: Alex Chen <alex.chen@huawei.com>
2021-02-19 21:27:55 +08:00
Huawei Technologies Co., Ltd
466af714ca msix: add valid.accepts methods to check address
Fix CVE-2020-13754

While doing msi-x mmio operations, a guest may send an address
that leads to an OOB access issue. Add valid.accepts methods to
ensure that ensuing mmio r/w operation don't go beyond regions.

Reported-by: Ren Ding <rding@gatech.edu>
Reported-by: Hanqing Zhao <hanqing@gatech.edu>
Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

patch link: https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00004.html
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-02-19 21:27:55 +08:00
Huawei Technologies Co., Ltd
c655a2b9f6 sd: sdhci: assert data_count is within fifo_buffer
Fix CVE-2020-17380

While doing multi block SDMA, transfer block size may exceed
the 's->fifo_buffer[s->buf_maxsz]' size. It may leave the
current element pointer 's->data_count' pointing out of bounds.
Leading the subsequent DMA r/w operation to OOB access issue.
Assert that 's->data_count' is within fifo_buffer.

 -> https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Fsdhci_oob_write1
 ==1459837==ERROR: AddressSanitizer: heap-buffer-overflow
 WRITE of size 54722048 at 0x61500001e280 thread T3
 #0  __interceptor_memcpy (/lib64/libasan.so.6+0x3a71d)
 #1  flatview_read_continue ../exec.c:3245
 #2  flatview_read ../exec.c:3278
 #3  address_space_read_full ../exec.c:3291
 #4  address_space_rw ../exec.c:3319
 #5  dma_memory_rw_relaxed ../include/sysemu/dma.h:87
 #6  dma_memory_rw ../include/sysemu/dma.h:110
 #7  dma_memory_read ../include/sysemu/dma.h:116
 #8  sdhci_sdma_transfer_multi_blocks ../hw/sd/sdhci.c:629
 #9  sdhci_write ../hw/sd/sdhci.c:1097
 #10 memory_region_write_accessor ../softmmu/memory.c:483
 ...

Reported-by: Ruhr-University <bugs-syssec@rub.de>
Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

patch link: https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg01175.html
Signed-off-by: Jiajie Li <lijiajie11@hw.com>
2021-02-19 21:27:55 +08:00
Huawei Technologies Co., Ltd
9d1a838153 ati: use vga_read_byte in ati_cursor_define
fix CVE-2019-20808

This makes sure reads are confined to vga video memory.

v3: use uint32_t, fix cut+paste bug.
v2: fix ati_cursor_draw_line too.

Reported-by: xu hang <flier_m@outlook.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190917111441.27405-3-kraxel@redhat.com

cherry-pick from aab0e2a661b2b6bf7915c0aefe807fb60d6d9d13
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-02-19 21:27:55 +08:00
openeuler-ci-bot
4b60010356 !193 spec: reorder the changelog
From: @yorifang
Reviewed-by: @zhendongchen
Signed-off-by: @zhendongchen
2021-02-01 09:57:34 +08:00
Ying Fang
e3ded2e85f spec: reorder the changelog
Nothing but just reorder the changelog.

Signed-off-by: Ying Fang <fangying1@huawei.com>
2021-01-19 20:20:54 +08:00
openeuler-ci-bot
e11bd557f0 !188 Automatically generate code patches with openeuler !62
From: @zhendongchen
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2021-01-18 10:02:42 +08:00
Euler Robot
22c2e01926 spec: Update release version with !62
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2021-01-15 11:26:56 +08:00
Euler Robot
554bceb1ac spec: Update patch and changelog with !62
memory: clamp cached translation in case it points to an MMIO region

Signed-off-by: Alex Chen <alex.chen@huawei.com>
2021-01-15 11:26:49 +08:00
Huawei Technologies Co., Ltd
f3ad2ddaeb memory: clamp cached translation in case it points to an MMIO region
In using the address_space_translate_internal API, address_space_cache_init
forgot one piece of advice that can be found in the code for
address_space_translate_internal:

    /* MMIO registers can be expected to perform full-width accesses based only
     * on their address, without considering adjacent registers that could
     * decode to completely different MemoryRegions.  When such registers
     * exist (e.g. I/O ports 0xcf8 and 0xcf9 on most PC chipsets), MMIO
     * regions overlap wildly.  For this reason we cannot clamp the accesses
     * here.
     *
     * If the length is small (as is the case for address_space_ldl/stl),
     * everything works fine.  If the incoming length is large, however,
     * the caller really has to do the clamping through memory_access_size.
     */

address_space_cache_init is exactly one such case where "the incoming length
is large", therefore we need to clamp the resulting length---not to
memory_access_size though, since we are not doing an access yet, but to
the size of the resulting section.  This ensures that subsequent accesses
to the cached MemoryRegionSection will be in range.

With this patch, the enclosed testcase notices that the used ring does
not fit into the MSI-X table and prints a "qemu-system-x86_64: Cannot map used"
error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry-picked from 4bfb024b)
Fix CVE-2020-27821
Signed-off-by: Alex Chen <alex.chen@huawei.com>
2021-01-15 11:26:49 +08:00
openeuler-ci-bot
26c73f3faf !184 Automatically generate code patches with openeuler !55
From: @zhendongchen
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2021-01-12 09:16:19 +08:00
Alex Chen
f482c6ad5d spec: updating the license info
Specify the version of CC-BY license

Signed-off-by: Alex Chen <alex.chen@huawei.com>
2021-01-08 14:10:43 +08:00
Euler Robot
2d6775dfc7 spec: Update release version with !55
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2021-01-06 11:26:52 +08:00
Euler Robot
552b2ac9fb spec: Update patch and changelog with !55
target/arm: Fix write redundant values to kvm

Signed-off-by: Alex Chen <alex.chen@huawei.com>
2021-01-06 11:26:52 +08:00
Huawei Technologies Co., Ltd
f54d232dae target/arm: Fix write redundant values to kvm
After modifying the value of a ID register, we'd better to try to write
it to KVM so that we can known the value is acceptable for KVM.
Because it may modify the registers' values of KVM, it's not suitable
for other registers.

(cherry-picked from a0d7a9de807639fcfcbe1fe037cb8772d459a9cf)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2021-01-06 11:26:52 +08:00
openeuler-ci-bot
0102d3b48d !175 Automatically generate code patches with openeuler !53
From: @zhendongchen
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2020-12-16 13:36:10 +08:00
Euler Robot
bad95d5aa7 spec: Update release version with !53
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2020-12-15 21:27:25 +08:00
Euler Robot
81894b8d69 spec: Update patch and changelog with !53
hw: usb: hcd-ohci: check for processed TD before retire
hw: ehci: check return value of 'usb_packet_map'
hw: usb: hcd-ohci: check len and frame_number variables
hw/net/e1000e: advance desc_offset in case of null descriptor

Signed-off-by: Alex Chen <alex.chen@huawei.com>
2020-12-15 21:27:18 +08:00
Huawei Technologies Co., Ltd
0b4be4c16c hw/net/e1000e: advance desc_offset in case of null descriptor
While receiving packets via e1000e_write_packet_to_guest() routine,
'desc_offset' is advanced only when RX descriptor is processed. And
RX descriptor is not processed if it has NULL buffer address.
This may lead to an infinite loop condition. Increament 'desc_offset'
to process next descriptor in the ring to avoid infinite loop.

Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry-picked from c2cb5116)
Fix CVE-2020-28916
Signed-off-by: Alex Chen <alex.chen@huawei.com>
2020-12-15 21:27:18 +08:00
Huawei Technologies Co., Ltd
4d2b07ca2b hw: usb: hcd-ohci: check len and frame_number variables
While servicing the OHCI transfer descriptors(TD), OHCI host
controller derives variables 'start_addr', 'end_addr', 'len'
etc. from values supplied by the host controller driver.
Host controller driver may supply values such that using
above variables leads to out-of-bounds access issues.
Add checks to avoid them.

AddressSanitizer: stack-buffer-overflow on address 0x7ffd53af76a0
  READ of size 2 at 0x7ffd53af76a0 thread T0
  #0 ohci_service_iso_td ../hw/usb/hcd-ohci.c:734
  #1 ohci_service_ed_list ../hw/usb/hcd-ohci.c:1180
  #2 ohci_process_lists ../hw/usb/hcd-ohci.c:1214
  #3 ohci_frame_boundary ../hw/usb/hcd-ohci.c:1257
  #4 timerlist_run_timers ../util/qemu-timer.c:572
  #5 qemu_clock_run_timers ../util/qemu-timer.c:586
  #6 qemu_clock_run_all_timers ../util/qemu-timer.c:672
  #7 main_loop_wait ../util/main-loop.c:527
  #8 qemu_main_loop ../softmmu/vl.c:1676
  #9 main ../softmmu/main.c:50

Reported-by: Gaoning Pan <pgn@zju.edu.cn>
Reported-by: Yongkang Jia <j_kangel@163.com>
Reported-by: Yi Ren <yunye.ry@alibaba-inc.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 20200915182259.68522-2-ppandit@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry-picked from 1328fe0c)
Fix CVE-2020-25624
Signed-off-by: Alex Chen <alex.chen@huawei.com>
2020-12-15 21:27:18 +08:00
Huawei Technologies Co., Ltd
e2fb3fc863 hw: ehci: check return value of 'usb_packet_map'
If 'usb_packet_map' fails, we should stop to process the usb
request.

Signed-off-by: Li Qiang <liq3ea@163.com>
Message-Id: <20200812161727.29412-1-liq3ea@163.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry-picked from 2fdb42d8)
Fix CVE-2020-25723
Signed-off-by: Alex Chen <alex.chen@huawei.com>
2020-12-15 21:27:18 +08:00
Huawei Technologies Co., Ltd
73ef40475f hw: usb: hcd-ohci: check for processed TD before retire
While servicing OHCI transfer descriptors(TD), ohci_service_iso_td
retires a TD if it has passed its time frame. It does not check if
the TD was already processed once and holds an error code in TD_CC.
It may happen if the TD list has a loop. Add check to avoid an
infinite loop condition.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-id: 20200915182259.68522-3-ppandit@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry-picked from 1be90ebe)
Fix CVE-2020-25625
Signed-off-by: Alex Chen <alex.chen@huawei.com>
2020-12-15 21:27:18 +08:00
openeuler-ci-bot
58e14e948c !170 slirp: check pkt_len before reading protocol header
From: @zhendongchen
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2020-12-14 20:34:28 +08:00
Alex Chen
7ef01abe88 slirp: check pkt_len before reading protocol header
While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input'
routines, ensure that pkt_len is large enough to accommodate the
respective protocol headers, lest it should do an OOB access.
Add check to avoid it.

CVE-2020-29129 CVE-2020-29130
  QEMU: slirp: out-of-bounds access while processing ARP/NCSI packets
 -> https://www.openwall.com/lists/oss-security/2020/11/27/1

Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <20201126135706.273950-1-ppandit@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry-picked from 2e1dcbc0)
Signed-off-by: Alex Chen <alex.chen@huawei.com>
2020-12-14 17:45:48 +08:00