289 Commits

Author SHA1 Message Date
Chen Qun
7a27cc000b vhost-user-gpu: fix memory leak in 'virgl_cmd_resource_unref' (CVE-2021-3544)
Fix CVE-2021-3544

The 'res->iov' will be leaked if the guest trigger following sequences:

	virgl_cmd_create_resource_2d
	virgl_resource_attach_backing
	virgl_cmd_resource_unref

This patch fixes this.

Fixes: CVE-2021-3544
Reported-by: default avatarLi Qiang <liq3ea@163.com>
virtio-gpu fix: 5e8e3c4c

 ("virtio-gpu: fix resource leak
in virgl_cmd_resource_unref"
Signed-off-by: default avatarLi Qiang <liq3ea@163.com>
Reviewed-by: Marc-André Lureau's avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210516030403.107723-6-liq3ea@163.com>
Signed-off-by: Gerd Hoffmann's avatarGerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-15 16:27:14 +08:00
Chen Qun
ce3cb1c69c vhost-user-gpu: fix memory leak while calling 'vg_resource_unref' (CVE-2021-3544)
Fix CVE-2021-3544

If the guest trigger following sequences, the attach_backing will be leaked:

	vg_resource_create_2d
	vg_resource_attach_backing
	vg_resource_unref

This patch fix this by freeing 'res->iov' in vg_resource_destroy.

Fixes: CVE-2021-3544
Reported-by: default avatarLi Qiang <liq3ea@163.com>
virtio-gpu fix: 5e8e3c4c

 ("virtio-gpu: fix resource leak
in virgl_cmd_resource_unref")
Reviewed-by: default avatarPrasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: default avatarLi Qiang <liq3ea@163.com>
Reviewed-by: Marc-André Lureau's avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210516030403.107723-5-liq3ea@163.com>
Signed-off-by: Gerd Hoffmann's avatarGerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-15 16:27:14 +08:00
Chen Qun
bca99d01be vhost-user-gpu: fix memory leak in vg_resource_attach_backing (CVE-2021-3544)
Fix CVE-2021-3544

Check whether the 'res' has already been attach_backing to avoid
memory leak.

Fixes: CVE-2021-3544
Reported-by: default avatarLi Qiang <liq3ea@163.com>
virtio-gpu fix: 204f01b3

 ("virtio-gpu: fix memory leak
in resource attach backing")
Signed-off-by: default avatarLi Qiang <liq3ea@163.com>
Reviewed-by: Marc-André Lureau's avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210516030403.107723-4-liq3ea@163.com>
Signed-off-by: Gerd Hoffmann's avatarGerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-15 16:27:14 +08:00
Chen Qun
d2cc143f75 vhost-user-gpu: fix resource leak in 'vg_resource_create_2d' (CVE-2021-3544)
Fix CVE-2021-3544

Call 'vugbm_buffer_destroy' in error path to avoid resource leak.

Fixes: CVE-2021-3544
Reported-by: default avatarLi Qiang <liq3ea@163.com>
Reviewed-by: default avatarPrasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: default avatarLi Qiang <liq3ea@163.com>
Reviewed-by: Marc-André Lureau's avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210516030403.107723-3-liq3ea@163.com>
Signed-off-by: Gerd Hoffmann's avatarGerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-15 16:27:14 +08:00
openeuler-ci-bot
45d6fab453 !303 Automatically generate code patches with openeuler !138
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-06-08 17:40:58 +08:00
Chen Qun
85ba290b27 spec: Update release version with !138
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-06-08 16:27:44 +08:00
Chen Qun
8b1f98e2e7 spec: Update patch and changelog with !138 fix CVE-2021-20181 #I3UFOQ !138
9pfs: Fully restart unreclaim loop (CVE-2021-20181)

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-06-08 16:27:33 +08:00
Chen Qun
aef4218d5f 9pfs: Fully restart unreclaim loop (CVE-2021-20181)
Fix CVE-2021-20181

Depending on the client activity, the server can be asked to open a huge
number of file descriptors and eventually hit RLIMIT_NOFILE. This is
currently mitigated using a reclaim logic : the server closes the file
descriptors of idle fids, based on the assumption that it will be able
to re-open them later. This assumption doesn't hold of course if the
client requests the file to be unlinked. In this case, we loop on the
entire fid list and mark all related fids as unreclaimable (the reclaim
logic will just ignore them) and, of course, we open or re-open their
file descriptors if needed since we're about to unlink the file.

This is the purpose of v9fs_mark_fids_unreclaim(). Since the actual
opening of a file can cause the coroutine to yield, another client
request could possibly add a new fid that we may want to mark as
non-reclaimable as well. The loop is thus restarted if the re-open
request was actually transmitted to the backend. This is achieved
by keeping a reference on the first fid (head) before traversing
the list.

This is wrong in several ways:
- a potential clunk request from the client could tear the first
  fid down and cause the reference to be stale. This leads to a
  use-after-free error that can be detected with ASAN, using a
  custom 9p client
- fids are added at the head of the list : restarting from the
  previous head will always miss fids added by a some other
  potential request

All these problems could be avoided if fids were being added at the
end of the list. This can be achieved with a QSIMPLEQ, but this is
probably too much change for a bug fix. For now let's keep it
simple and just restart the loop from the current head.

Fixes: CVE-2021-20181
Buglink: https://bugs.launchpad.net/qemu/+bug/1911666
Reported-by: Zero Day Initiative <zdi-disclosures@trendmicro.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Message-Id: <161064025265.1838153.15185571283519390907.stgit@bahia.lan>
Signed-off-by: Greg Kurz <groug@kaod.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-08 16:27:33 +08:00
openeuler-ci-bot
f7cf4f2d00 !301 为block-rbd, block-iscsi和block-ssh添加strip
From: @imxcc
Reviewed-by: @Chuan-Zheng
Signed-off-by: @Chuan-Zheng
2021-06-03 20:31:11 +08:00
imxcc
768f8c34c5 add strip for block-iscsi.so, block-rbd.so and block-ssh.so
Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-06-02 20:37:56 +08:00
openeuler-ci-bot
d2e1026f00 !298 Automatically generate code patches with openeuler !132
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-06-02 12:45:48 +08:00
Chen Qun
c2a5e4575f spec: Update release version with !132
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-06-02 11:29:42 +08:00
Chen Qun
3afc75890f spec: Update patch and changelog with !132 fix Uninitialized Free Vulnerability !132
bugfix: fix Uninitialized Free Vulnerability

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-06-02 11:29:33 +08:00
Chen Qun
16a74ee234 bugfix: fix Uninitialized Free Vulnerability
Signed-off-by: nocjj <1250062498@qq.com>
Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-06-02 11:29:33 +08:00
openeuler-ci-bot
c62dab578c !295 Automatically generate code patches with openeuler !130
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-06-01 21:54:52 +08:00
Chen Qun
3a33cf0c29 spec: Update release version with !130
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-06-01 21:27:04 +08:00
Chen Qun
cb7537b60d spec: Update patch and changelog with !130 fix CVE-2020-15469 #I1NJI5 !130
hw/pci-host: add pci-intack write method
pci-host: add pcie-msi read method
vfio: add quirk device write method
prep: add ppc-parity write method
nvram: add nrf51_soc flash read method
spapr_pci: add spapr msi read method
tz-ppc: add dummy read/write methods
imx7-ccm: add digprog mmio write method

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-06-01 21:27:03 +08:00
Chen Qun
7129ce02d3 imx7-ccm: add digprog mmio write method
fix CVE-2020-15469

Add digprog mmio write method to avoid assert failure during
initialisation.

Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:03 +08:00
Chen Qun
8953a112fa tz-ppc: add dummy read/write methods
fix CVE-2020-15469

Add tz-ppc-dummy mmio read/write methods to avoid assert failure
during initialisation.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:03 +08:00
Chen Qun
17f71304b9 spapr_pci: add spapr msi read method
fix CVE-2020-15469

Add spapr msi mmio read method to avoid NULL pointer dereference
issue.

Reported-by: Lei Sun <slei.casper@gmail.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:03 +08:00
Chen Qun
c260a617c0 nvram: add nrf51_soc flash read method
fix CVE-2020-15469

Add nrf51_soc mmio read method to avoid NULL pointer dereference
issue.

Reported-by: Lei Sun <slei.casper@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:03 +08:00
Chen Qun
9dc146e01a prep: add ppc-parity write method
fix CVE-2020-15469

Add ppc-parity mmio write method to avoid NULL pointer dereference
issue.

Reported-by: Lei Sun <slei.casper@gmail.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:02 +08:00
Chen Qun
5217dca9c1 vfio: add quirk device write method 2021-06-01 21:27:02 +08:00
Chen Qun
949e643611 pci-host: add pcie-msi read method
fix CVE-2020-15469

Add pcie-msi mmio read method to avoid NULL pointer dereference
issue.

Reported-by: Lei Sun <slei.casper@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:02 +08:00
Chen Qun
d4c8f9dfd5 hw/pci-host: add pci-intack write method
fix CVE-2020-15469

Add pci-intack mmio write method to avoid NULL pointer dereference
issue.

Reported-by: Lei Sun <slei.casper@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-06-01 21:27:02 +08:00
openeuler-ci-bot
2551ad5ecd !289 Automatically generate code patches with openeuler !117
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-05-20 21:43:48 +08:00
Chen Qun
ec5b42fe30 spec: Update release version with !117
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-05-20 21:27:15 +08:00
Chen Qun
000a0ed8d1 spec: Update patch and changelog with !117 fix CVE-2021-3416 #I3DW99 && fix CVE-2021-3409 #I3E5M7 && fix CVE-2020-25085 #I3J7F2 !117
hw/sd: sdhci: Don't transfer any data when command time out
hw/sd: sdhci: Don't write to SDHC_SYSAD register when transfer is in progress
hw/sd: sdhci: Correctly set the controller status for ADMA
hw/sd: sdhci: Limit block size only when SDHC_BLKSIZE register is writable
hw/sd: sdhci: Reset the data pointer of s->fifo_buffer[] when a different block size is programmed
net: introduce qemu_receive_packet()
e1000: switch to use qemu_receive_packet() for loopback
dp8393x: switch to use qemu_receive_packet() for loopback packet
sungem: switch to use qemu_receive_packet() for loopback
tx_pkt: switch to use qemu_receive_packet_iov() for loopback
rtl8139: switch to use qemu_receive_packet() for loopback
pcnet: switch to use qemu_receive_packet() for loopback
cadence_gem: switch to use qemu_receive_packet() for loopback
lan9118: switch to use qemu_receive_packet() for loopback

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
bf03ed628e lan9118: switch to use qemu_receive_packet() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
0ab1ee42ce cadence_gem: switch to use qemu_receive_packet() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
933ce84b06 pcnet: switch to use qemu_receive_packet() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Buglink: https://bugs.launchpad.net/qemu/+bug/1917085
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
aaacad5f87 rtl8139: switch to use qemu_receive_packet() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Buglink: https://bugs.launchpad.net/qemu/+bug/1910826
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
c2c60c4c1f tx_pkt: switch to use qemu_receive_packet_iov() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_receive_iov() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
eaeac4ebc8 sungem: switch to use qemu_receive_packet() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
39989f83ee dp8393x: switch to use qemu_receive_packet() for loopback packet
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
4d2eca9a6f e1000: switch to use qemu_receive_packet() for loopback
Fix CVE-2021-3416

This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
775c850c1f net: introduce qemu_receive_packet()
Fix CVE-2021-3416

Some NIC supports loopback mode and this is done by calling
nc->info->receive() directly which in fact suppresses the effort of
reentrancy check that is done in qemu_net_queue_send().

Unfortunately we can use qemu_net_queue_send() here since for loop
back there's no sender as peer, so this patch introduce a
qemu_receive_packet() which is used for implementing loopback mode
for a NIC with this check.

NIC that supports loopback mode will be converted to this helper.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:14 +08:00
Chen Qun
39931380cb hw/sd: sdhci: Reset the data pointer of s->fifo_buffer[] when a different block size is programmed
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409

If the block size is programmed to a different value from the
previous one, reset the data pointer of s->fifo_buffer[] so that
s->fifo_buffer[] can be filled in using the new block size in
the next transfer.

With this fix, the following reproducer:

outl 0xcf8 0x80001010
outl 0xcfc 0xe0000000
outl 0xcf8 0x80001001
outl 0xcfc 0x06000000
write 0xe000002c 0x1 0x05
write 0xe0000005 0x1 0x02
write 0xe0000007 0x1 0x01
write 0xe0000028 0x1 0x10
write 0x0 0x1 0x23
write 0x2 0x1 0x08
write 0xe000000c 0x1 0x01
write 0xe000000e 0x1 0x20
write 0xe000000f 0x1 0x00
write 0xe000000c 0x1 0x32
write 0xe0000004 0x2 0x0200
write 0xe0000028 0x1 0x00
write 0xe0000003 0x1 0x40

cannot be reproduced with the following QEMU command line:

$ qemu-system-x86_64 -nographic -machine accel=qtest -m 512M \
      -nodefaults -device sdhci-pci,sd-spec-version=3 \
      -drive if=sd,index=0,file=null-co://,format=raw,id=mydrive \
      -device sd-card,drive=mydrive -qtest stdio

Cc: qemu-stable@nongnu.org
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409
Fixes: d7dfca0807a0 ("hw/sdhci: introduce standard SD host controller")
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Cornelius Aschermann (Ruhr-University Bochum)
Reported-by: Muhammad Ramdhan
Reported-by: Sergej Schumilo (Ruhr-University Bochum)
Reported-by: Simon Wrner (Ruhr-University Bochum)
Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Buglink: https://bugs.launchpad.net/qemu/+bug/1909418
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1928146
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:13 +08:00
Chen Qun
3624aaffe0 hw/sd: sdhci: Limit block size only when SDHC_BLKSIZE register is writable
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409

The codes to limit the maximum block size is only necessary when
SDHC_BLKSIZE register is writable.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:13 +08:00
Chen Qun
dd8a18a37e hw/sd: sdhci: Correctly set the controller status for ADMA
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409

When an ADMA transfer is started, the codes forget to set the
controller status to indicate a transfer is in progress.

With this fix, the following 2 reproducers:

https://paste.debian.net/plain/1185136
https://paste.debian.net/plain/1185141

cannot be reproduced with the following QEMU command line:

$ qemu-system-x86_64 -nographic -machine accel=qtest -m 512M \
      -nodefaults -device sdhci-pci,sd-spec-version=3 \
      -drive if=sd,index=0,file=null-co://,format=raw,id=mydrive \
      -device sd-card,drive=mydrive -qtest stdio

Cc: qemu-stable@nongnu.org
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409
Fixes: d7dfca0807a0 ("hw/sdhci: introduce standard SD host controller")
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Cornelius Aschermann (Ruhr-University Bochum)
Reported-by: Muhammad Ramdhan
Reported-by: Sergej Schumilo (Ruhr-University Bochum)
Reported-by: Simon Wrner (Ruhr-University Bochum)
Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Buglink: https://bugs.launchpad.net/qemu/+bug/1909418
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1928146
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:13 +08:00
Chen Qun
4a0b5b3647 hw/sd: sdhci: Don't write to SDHC_SYSAD register when transfer is in progress
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409

Per "SD Host Controller Standard Specification Version 7.00"
chapter 2.2.1 SDMA System Address Register:

This register can be accessed only if no transaction is executing
(i.e., after a transaction has stopped).

With this fix, the following reproducer:

outl 0xcf8 0x80001010
outl 0xcfc 0xfbefff00
outl 0xcf8 0x80001001
outl 0xcfc 0x06000000
write 0xfbefff2c 0x1 0x05
write 0xfbefff0f 0x1 0x37
write 0xfbefff0a 0x1 0x01
write 0xfbefff0f 0x1 0x29
write 0xfbefff0f 0x1 0x02
write 0xfbefff0f 0x1 0x03
write 0xfbefff04 0x1 0x01
write 0xfbefff05 0x1 0x01
write 0xfbefff07 0x1 0x02
write 0xfbefff0c 0x1 0x33
write 0xfbefff0e 0x1 0x20
write 0xfbefff0f 0x1 0x00
write 0xfbefff2a 0x1 0x01
write 0xfbefff0c 0x1 0x00
write 0xfbefff03 0x1 0x00
write 0xfbefff05 0x1 0x00
write 0xfbefff2a 0x1 0x02
write 0xfbefff0c 0x1 0x32
write 0xfbefff01 0x1 0x01
write 0xfbefff02 0x1 0x01
write 0xfbefff03 0x1 0x01

cannot be reproduced with the following QEMU command line:

$ qemu-system-x86_64 -nographic -machine accel=qtest -m 512M \
       -nodefaults -device sdhci-pci,sd-spec-version=3 \
       -drive if=sd,index=0,file=null-co://,format=raw,id=mydrive \
       -device sd-card,drive=mydrive -qtest stdio

Cc: qemu-stable@nongnu.org
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409
Fixes: d7dfca0807a0 ("hw/sdhci: introduce standard SD host controller")
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Cornelius Aschermann (Ruhr-University Bochum)
Reported-by: Muhammad Ramdhan
Reported-by: Sergej Schumilo (Ruhr-University Bochum)
Reported-by: Simon Wrner (Ruhr-University Bochum)
Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Buglink: https://bugs.launchpad.net/qemu/+bug/1909418
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1928146
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:13 +08:00
Chen Qun
8794be6251 hw/sd: sdhci: Don't transfer any data when command time out
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409

At the end of sdhci_send_command(), it starts a data transfer if the
command register indicates data is associated. But the data transfer
should only be initiated when the command execution has succeeded.

With this fix, the following reproducer:

outl 0xcf8 0x80001810
outl 0xcfc 0xe1068000
outl 0xcf8 0x80001804
outw 0xcfc 0x7
write 0xe106802c 0x1 0x0f
write 0xe1068004 0xc 0x2801d10101fffffbff28a384
write 0xe106800c 0x1f
0x9dacbbcad9e8f7061524334251606f7e8d9cabbac9d8e7f60514233241505f
write 0xe1068003 0x28
0x80d000251480d000252280d000253080d000253e80d000254c80d000255a80d000256880d0002576
write 0xe1068003 0x1 0xfe

cannot be reproduced with the following QEMU command line:

$ qemu-system-x86_64 -nographic -M pc-q35-5.0 \
      -device sdhci-pci,sd-spec-version=3 \
      -drive if=sd,index=0,file=null-co://,format=raw,id=mydrive \
      -device sd-card,drive=mydrive \
      -monitor none -serial none -qtest stdio

Cc: qemu-stable@nongnu.org
Fixes: CVE-2020-17380
Fixes: CVE-2020-25085
Fixes: CVE-2021-3409
Fixes: d7dfca0807a0 ("hw/sdhci: introduce standard SD host controller")
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Cornelius Aschermann (Ruhr-University Bochum)
Reported-by: Muhammad Ramdhan
Reported-by: Sergej Schumilo (Ruhr-University Bochum)
Reported-by: Simon Wrner (Ruhr-University Bochum)
Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Buglink: https://bugs.launchpad.net/qemu/+bug/1909418
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1928146
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-20 21:27:13 +08:00
openeuler-ci-bot
37ac08e1e0 !281 Automatically generate code patches with openeuler !113
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-05-19 17:11:00 +08:00
Chen Qun
5003b207ed spec: Update release version with !113
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-05-19 11:27:19 +08:00
Chen Qun
8bd85496fb spec: Update patch and changelog with !113 fix CVE-2021-3392 #I3E5MB !113
scsi: mptsas: dequeue request object in case of an error

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-05-19 11:27:09 +08:00
Chen Qun
88ca69705a scsi: mptsas: dequeue request object in case of an error
Fix CVE-2021-3392

While processing SCSI i/o requests in mptsas_process_scsi_io_request(),
the Megaraid emulator appends new MPTSASRequest object 'req' to
the 's->pending' queue. In case of an error, this same object gets
dequeued in mptsas_free_request() only if SCSIRequest object
'req->sreq' is initialised. This may lead to a use-after-free issue.
Unconditionally dequeue 'req' object from 's->pending' to avoid it.

Fixes: CVE-2021-3392
Buglink: https://bugs.launchpad.net/qemu/+bug/1914236
Reported-by: Cheolwoo Myung <cwmyung@snu.ac.kr>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>

Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
2021-05-19 11:27:09 +08:00
openeuler-ci-bot
da8ce906cb !272 Automatically generate code patches with openeuler !97
From: @kuhnchen18
Reviewed-by: @kevinzhu1
Signed-off-by: @kevinzhu1
2021-05-12 09:00:06 +08:00
Chen Qun
bbf3284f03 spec: Update release version with !97
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-05-11 21:27:13 +08:00
Chen Qun
4facc655e6 spec: Update patch and changelog with !97 arm/cpu: Fixed function undefined error at compile time under arm !97
arm/cpu: Fixed function undefined error at compile time under arm

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-05-11 21:27:11 +08:00
Chen Qun
1c362cdbe3 arm/cpu: Fixed function undefined error at compile time under arm
Add the compilation option CONFIG_KVM while using
    "kvm_arm_cpu_feature_supported" and "kvm_arm_get_one_reg".
    In arm, the default value of CONFIG_KVM is no.

    While the target is arm, the compilation fails because
    the function "kvm_arm_cpu_feature_supporte" is declared
    or the function "kvm_arm_get_one_reg" is not defined.

Signed-off-by: zhanghao1 <zhanghao1@kylinos.cn>
2021-05-11 21:27:11 +08:00